5

This is how I am trying to send an email:

MailMessage mail = new MailMessage();
mail.From = new MailAddress("test@test.com");
mail.To.Add("test1@test.com");
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:<test@test.com>
250 Okey dokey
RCPT TO:<test1@test.com>
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?

Vladimirs
  • 8,232
  • 4
  • 43
  • 79
  • So there are no emails shown in the sys tray app for smtp4dev? Are you running another server on port 25 on localhost? – Jay Oct 02 '15 at 14:01
  • @Jay no email in the sys tray and also No of Msgs value in Sessions tab is 0 for ALL sessions. Not sure what you mean by another server? Are you asking if I am running another instance of smtp4dev with same settings (if so then no - smtp4dev allows only listen unique host/port)? – Vladimirs Oct 02 '15 at 14:09
  • I meant any other process that listens on that port, but I guess smtp4dev wouldn't bind to it if you did. Are you using a proxy at all? – Jay Oct 02 '15 at 14:11
  • @Jay I am not 100% sure about proxy, at least I didn't set/seen it anywhere. Anyway would proxy even matter in case if I am sending email from localhost and listening it at localhost? – Vladimirs Oct 02 '15 at 14:19
  • The reason no message is showing up is because the client is sending a RSET command instead of a DATA command followed by the message data. – jstedfast Jan 06 '16 at 20:45

2 Answers2

6

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.

Pete Davis
  • 1,127
  • 9
  • 15
-1

check you IIS smtp settings, it should not save emails to disk

Bogdan Sahlean
  • 19,233
  • 3
  • 42
  • 57
Vladimir Kruglov
  • 196
  • 1
  • 19