SMTP

From LQWiki
Jump to: navigation, search

SMTP (Simple Mail Transfer Protocol) is a protocol for servers to send email between one another. Most common mail protocol on the Internet.

SMTP daemons

Tips and tricks

You can manually contact your SMTP server using telnet to send email. All you need to know is the server's name and the port (usually 25).

Authenticate using telnet

telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 duffman.site ESMTP Postfix

Send the SMTP authentication command

AUTH LOGIN
334 VXNlcm5hbWU6

Send the username base-64-encrypted (dummy in this case).

ZHVtbXk=
334 UGFzc3dvcmQ6

Send the password base64 encrypted

cGFzc3dvcmQ=
235 2.7.0 Authentication successful

Send a mail using telnet

So let's telnet in:

  telnet mail.somehost.com 25

You should now be greeted by some text that looks like:

  Trying 193.29.23.192...
  Connected to mail.somehost.com
  Escape character is '^]'
  220 sbh14.somehost.com ESMTP server ready Wed, 15 Mar 2004 02:32:40 +0100

Now to start sending your mail you write:

  HELO somehost.com
  MAIL FROM:<myaddress@somehost.com>

Note: You can specify any address as the sender, because there is no sender verification

  RCPT TO:<mailaddress@anotherhost.com>
  DATA
  Subject:Hello World!
  From:Elvis Presley <myaddress@somehost.com>
  Hi you at mailaddress. This is a mail sent by telnetting to an smtp server. 
  You can    write as much as you want here. When you are finished enter a . as 
  the only character on a new line.
  Yours, Elvis
  .

To quit just write quit

  quit

See also