the following code works well in windows xp os but in windows 7 doesn't
i have tried different ports (587,465, 25) but nevetheless it does not work. I think than problem with some configurations either in iis7 or asp.net or os etc.
please help
string host = "smtp.mail.ru";
string to = "
[email protected]";
string from = "
[email protected]";// от кого идет письмо
string subject ="Testing";
string body = "Testing email opportunity";
string user = "somename";// имя пользователя
string pass = "password";
MailMessage message = new MailMessage(from, to, subject, body);
SmtpClient smtpClient = new SmtpClient(host, 25);
smtpClient.Credentials = new NetworkCredential(user, pass);
smtpClient.EnableSsl = true;
try
{
smtpClient.Send(message);
MessageBox.Show("Your message is delivered");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message.ToString());
}