Hi, i am yogesh and i have a problem in sending email using free smtp server.
I have windows 7 prof...(os).
windows7 has not haveing default smtp server installed... so what i have to do please
give me example of step by step installing smtp server as i have tried many options
i also used gmail server but failed. I also found that windows 7 no longer support
smtp server so what to do... my code i just tried using gmail server is as follows..
string from = "imyogesh@mail.com";
string to = "imyogesh@mail.com";
System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
mail.To.Add(to);
mail.From = new MailAddress(from, "One Ghost" , System.Text.Encoding.UTF8);
mail.Subject = "This is a test mail" ;
mail.SubjectEncoding = System.Text.Encoding.UTF8;
mail.Body = "This is Email Body Text";
mail.BodyEncoding = System.Text.Encoding.UTF8;
mail.IsBodyHtml = true ;
mail.Priority = MailPriority.High;
SmtpClient client = new SmtpClient();
client.Credentials = new System.Net.NetworkCredential(from, "PASSWORD");
client.Port = 587;
client.Host = "smtp.gmail.com";
client.EnableSsl = true;
try
{
client.Send(mail);
}
catch (Exception ex)
{
Exception ex2 = ex;
string errorMessage = string.Empty;
while (ex2 != null)
{
errorMessage += ex2.ToString();
ex2 = ex2.InnerException;
}
HttpContext.Current.Response.Write(errorMessage );
}
what is wrong with this code.
i have installed iis7... and i don't know how to install smtp serve..
please help me i m trying since 5 day. i need to test my application for sending emails.
As windows 7 is not supporting smtp server what i have to do.
with this code iam getting error.
pleas suggest me solution....