Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to receive emails with smtp4dev

This is how I am trying to send an email:

MailMessage mail = new MailMessage();
mail.From = new MailAddress("[email protected]");
mail.To.Add("[email protected]");
mail.Subject = "Subject";
mail.Body = "Body";

SmtpClient smtp = new SmtpClient("localhost", 25);
smtp.UseDefaultCredentials = true;
smtp.Send(mail);

In smtp4dev I configured domain name to be localhost and port number - 25, all other settings I left in their default values.

When I am trying to send an email - it sends it successfully, however I cannot see this email, session logs also doesn't say anything useful:

220 localhost smtp4dev ready
EHLO MobileVladimirs
250-Nice to meet you.
250-8BITMIME
250-STARTTLS
250-AUTH=CRAM-MD5 PLAIN LOGIN ANONYMOUS
250-AUTH CRAM-MD5 PLAIN LOGIN ANONYMOUS
250 SIZE
MAIL FROM:<[email protected]>
250 Okey dokey
RCPT TO:<[email protected]>
250 Recipient accepted
RSET
250 Rset completed

Please tell me where I am wrong or please explain how I can find out whats happening with email I sent?

like image 612
Vladimirs Avatar asked Oct 02 '15 13:10

Vladimirs


1 Answers

Are you using Norton 360 or the like? That program will interfere with port 25 as part of its antispam feature.

For Norton 360 you will see port 25 listed under Settings -> AntiSpam -> Protected Ports, and it cannot be changed.

By changing dev settings to port 26 I was able to get both smtp4dev and papercut to work.

like image 53
Pete Davis Avatar answered Oct 31 '22 23:10

Pete Davis