Sending eMail Using Telnet (SMTP Commands)

If you ever find yourself in a situation where you have to test a mail server via telnet, here is how you do it.

In order to access your mailbox you will need 2 things:

  • The address of a mail server capable of relaying for you - usually provided by your ISP
  • A valid email address

The first thing to do is to open a connection from your computer to your mail server.

  • Open a telnet connection to server.
  • Input HELO command
  • Specify MAIL FROM (The mail server has no choice but to take your word for it as of RFC822-RFC1123. On many mailservers the space after the : is required rather that optional.)
  • Specify recipient RCPT TO
  • Input message DATA (Finish with the single '.' in a new line
  • Issue QUIT command

501… Sender domain must exist - The domain that you are sending from must exist 503 Need MAIL before RCPT - A recipient has been specified before a sender. 550 mail@domain.ext… Relaying Denied - The mail server has refused to relay mail for you, this may be for any number of reasons but typical resons include:

  • Not using this provider for an internet connection and/or
  • Not using an email address provided by the owner of the server.

Some things to watch out for:

  1. If you type too quickly, sometimes it won't recognise your text
  2. The backspace key sometimes does not work with some telnet clients (even though it may seem as though it does)
220 ESMTP Service (Lotus Domino Release 8.5.3FP5) ready at Thu, 27 Nov 2014 15:48:55 +0100
250 Hello ([]), pleased to meet you
250 Sender OK
250 Recipient OK
354 Enter message, end with "." on a line by itself

another line
250 Message accepted for delivery
221 SMTP Service closing transmission channel

Connection to host lost.
Enter your comment:
164 +14 =
  • general/networking/send_mail_smtp.txt
  • Last modified: 2019/10/31 09:05
  • by