2007/01/29

How to send mail manually through a smtp telnet session

First, connect to the mail server.
telnet myserver.com 25
A successful connection will produce
...
Connected to myserver.com
Escape character is '^]'.
220 myserver.com ESMTP Sendmail

Next, specify the email source domain:
HELO local.domain.com
This should result in:
250 myserver.com Hello local.domain.com [1.2.3.4]
Specify the email source address:
MAIL FROM: myaddress@domain.com
This should result in:
250 2.1.0 myaddress@domain.com... Sender ok
Specify the recipient address:
RCPT TO: otheraddress@myserver.com
This should result in:
250 2.1.0 otheraddress@myserver.com... Recipient ok
Then start the message with this command
DATA
To specify a Subject, CC: list, etc., add for example:
Subject:my subject
followed by the enter key twice, to conform to RFC 882.
Then type the rest of your message:
Hello, world
Then, close your message with .
.
To close the SMTP connection:
QUIT

No comments: