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?
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.
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