$ telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 localhost.localdomain ESMTP Sendmail 8.13.1/8.13.1; Thu 10 Mar 2005 20:02:09 +1300
$ HELO localhost.localdomain
250 localhost.localdomain Hello localdomain [127.0.0.1], pleased to meet you
$ MAIL FROM: from_who@domain.com
250 2.1.0 from_who@domain.com... Sender ok
$RCPT TO: to_who@domain.com
250 2.1.5 to_who@domain.com... Recipient ok
$ DATA
354 Enter mail, end with "." on a line by itself
$ Subject: subject goes here
$
$ Message goes here and ends with a dot
$ .
250 2.0.0 <some random message ID> Message accepted for delivery
$ QUIT
221 2.0.0 localhost.localdomain closing connection
Connection closed by foreign host.
Remember the $ signs are not included and just mark when the commands you enter happen.
The other shown messages, are the usual OK messages produced by the SMTP to say everything is ok, and going correctly.
You can also use this method, by using PHP sockets, so you can connect to an SMTP server, pass the commands, and hopefully the mail will be checked. PHP Mail function maybe easier to use though.
Subject: needs two enters after it, to be valid else it won't work. e.g. Subject: this subject\n\n
Once you've finished with the DATA you end it with a single dot on a line by itself and that's it, quit the connection and it'll be sent.
Cheers,
MC

