How to send email when port 25 is blocked
I run Windows Server 2008 as my development environment and use the local SMTP service to send emails for any website or application that I am developing and that needs to send email. Recently I was working on a Billing Application that needed to send emails and I wanted to send several to myself for testing, but for some reason the emails were not being sent.
I followed this article from Scott Forsyth about how to debug smtp issues. After connecting using Telnet and manually sending a message, I saw the email message sitting there in my queue (C:\inetpub\mailroot\Queue) and not going out.
Next I checked the event log and found this message (I was sending to a gmail account for testing):
Message delivery to the host 'XXX.XX.XXX.XX' failed while delivering to the remote domain 'gmail.com' for the following reason: The remote server did not respond to a connection attempt.
This indicated that my local smtp server was not able to connect to gmail’s mail server. I use Verizon Residential DSL as my Internet Service Provider (ISP). Some time in 2009, Verizon Residential DSL began blocking port 25. This caused my local development machine SMTP server to not be able to send email.
An easy workaround that I found was to send using my Verizon DSL email account. To do this you need to specify port 587 and also your credentials for your Verizon account:
System.Net.Mail.SmtpClient smtpClient = null;
smtpClient = new System.Net.Mail.SmtpClient("outgoing.verizon.net", 587);
smtpClient.Credentials = new System.Net.NetworkCredential("account@verizon.net", "password");
smtpClient.Send(m);
Verizon lets you create multiple email accounts so it was easy to create a secondary account just for me to send through instead of using my primary account.