Getting Error message "failure sending mail " while Sendmail using localhaost in C#
<p>I'm trying to send mail from machine(Windows 7), which doesn't have IIS server and mail server but this machine is connected to LAN. Do we really need IIS server to send mail with localhost. Please help me to understand the concept of localhost, What are the pre-conditions are required to use "localhost" as SMTP server.
I tried with Gmail SMTP host, it was working fine without any issues.</p>

<p>Here is my Code :</p>

<pre><code>SmtpClient client = new SmtpClient();               
client.Host = "localhost";                
client.Port = 25;
client.EnableSsl = true;
client.Credentials = new System.Net.NetworkCredential("Admin", "password");
client.UseDefaultCredentials = false;              
try
{
client.Send(mail);
}
catch (Exception ex)
{
logger.LogInfo(ex.Message); 
}
</code></pre>

<p>Thanks,
Delwin</p>
