What am I doing wrong here?
private void SendMail(string from, string body)
{
string mailServerName = "plus.pop.mail.yahoo.com";
MailMessage message = new MailMessage(from, "[email protected]", "feedback", body);
SmtpClient mailClient = new SmtpClient();
mailClient.Host = mailServerName;
mailClient.Send(message);
message.Dispose();
}
I got the following error:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 209.191.108.191:25
You are using the wrong server. You will need to use the SMTP settings.
try this server: plus.smtp.mail.yahoo.com Their site notes this host as SSL.
private void SendMail(string from, string body)
{
string mailServerName = "plus.smtp.mail.yahoo.com";
int mailServerPort = 465;
string toAddress = "[email protected]";
string subject = "feedback";
string username = "user";
string password = "password";
SmtpClient mailClient = new SmtpClient(mailServerName,
mailServerPort);
mailClient.Host = mailServerName;
mailClient.Credentials = new NetworkCredential(username,
password);
mailClient.EnableSsl = true;
using (MailMessage message = new MailMessage(from,
toAddress,
subject,
body))
mailClient.Send(message);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With