Answered by:
Sending mail error – C#

Question
-
User-858990475 posted
My code works well on local machine but when I deploy it, it shows error – Failure sending mail.
MailAddress to = new MailAddress(toEmail); MailAddress from = new MailAddress("aaa@bbb.com", "Title"); EMailMessage email = new EMailMessage(from, to); email.Subject = “Subject”; email.Body = " Body"; SmtpClient smtp = new SmtpClient("mail.abcde.net"); smtp.Port = 26; smtp.EnableSsl = false; smtp.Credentials = new NetworkCredential("user", "pass"); smtp.Send(mailmsg);
Please help
Tuesday, May 28, 2013 7:19 AM
Answers
-
User1773676862 posted
I recommend you check your ports on the remote machine. Standard SMTP port is 25 and your code is using 26. It’s quite possible that it’s blocked by firewall or something.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, May 29, 2013 5:54 AM
All replies
-
Tuesday, May 28, 2013 8:51 AM
-
User1478604991 posted
Please check your firewall settings. The server might not have access to the SMTP server which could be an issue. Try pinging the SMTP server address from the server using command prompt and verify the connection.
Tuesday, May 28, 2013 1:50 PM -
User311508580 posted
Hi Fred,
Please kindly check your setting again and your code. You may ask your hosting provider. :)
Tuesday, May 28, 2013 2:13 PM -
User1773676862 posted
I recommend you check your ports on the remote machine. Standard SMTP port is 25 and your code is using 26. It’s quite possible that it’s blocked by firewall or something.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, May 29, 2013 5:54 AM