I'm trying to send emails (using my hotmail account) and I'm encountering the error below:
Aconnectionattemptfailedbecausetheconnectedcomponentdidnot responded\r\nwithaperiodoftimeortheconnection establishedfailed\r\nbecausetheconnectedhostdidnotrespond 65.55.176.126:25
ThemethodI'musingisbelow:
publicvoidsendEMailThroughHotMail(){try{//MailMessageMailMessagemM=newMailMessage();//MailAddressmM.From=newMailAddress("[email protected]");
//receiver email id
mM.To.Add("[email protected]");
//subject of the email
mM.Subject = "your subject line will go here";
//add the body of the email
mM.Body = "Body of the email";
mM.IsBodyHtml = true;
//SMTP client
SmtpClient sC = new SmtpClient("smtp.live.com");
//port number for Hot mail
sC.Port = 25;
//credentials to login in to hotmail account
sC.Credentials = new NetworkCredential("[email protected]", "xxxxxx");
//enabled SSL
sC.EnableSsl = true;
//Send an email
sC.Send(mM);
}
catch (Exception ex)
{
throw ex;
}
}
I also tried sending through gmail, but Google interpreted my attempt to send as an attempt to attack ¬ ¬