Thursday, January 21, 2010

Telnet commands to Send Email

I can never remember the commands to send an email via Telnet so here they are again mostly for my benefit. Examples of <smtp server> are

C:\windows>telnet <smtp server> 25
Which should return
Connected to <smtp server>

HELO <smtp server>



Subject: Subject line of email
This text goes in the body of the email

Which should return
250 2.0.0 ???????? Message accepted for delivery
250 2.0.0 ???????? Message queued

IMPORTANT: The MAIL FROM email address should be a valid email address. Not only must the be the same domain the SMTP server is in, but don't assume that a made up email name will work. I've wasted hours trying to figure out why an email was not sent just because I didn't use a valid "mail from" address.

Should you not be able to connect to the SMTP server using the telnet command it may be because you have a firewall on the server that is blocking all outbound traffic on port 25. Or you've get the wrong SMTP server name.

No comments: