Mail Talk SMTP and POP

Standard SMTP Conversation

Mailserver says: 220 mailserver.domain.com SMTP ... Greetings
    Sender says: Helo sender.host.name
Mailserver says: 250 Nice to meet you
    Sender says: Mail From:<sender@his.address>
Mailserver says: 250 Sender ok
    Sender says: Rcpt To:<recipient@his.address>
Mailserver says: 250 Recipient ok
    Sender says: Data
Mailserver says: 354 Enter mail, end with "." on a line by itself
    Sender says: Blah, blah, blah...            
    Sender says: <enter>.<enter>
Mailserver says: 250 Message accepted for delivery
    Sender says: Quit

Example with strict syntax:

Here is an example of a transaction between a client (C) and an SMTP server (S)

S: 220 smtp.commentcamarche.net SMTP Ready
C: EHLO machine1.commentcamarche.net
S: 250 smtp.commentcamarche.net
C: MAIL FROM:<webmaster@kioskea.net>

S: 250 OK
C: RCPT TO:<meandus@meandus.net>

S: 250 OK
C: RCPT TO:<tittom@tittom.fr>

S: 550 No such user here
C: DATA
S: 354 Start mail input; end with <CRLF>.<CRLF>

C: Subject: Hello
C: Hello Meandus,
C: How are things?
C:
C: See you soon!
C: <CRLF>.<CRLF>

S: 250 OK
C: QUIT
R: 221 smtp.commentcamarche.net closing transmission


SMTP Commands to Issue Example

HELO python.directsales.com
MAIL FROM:manager@computersupply.com
RCPT TO:james@directsales.com
Data
BLAH BLAH BLAH
.
QUIT

POP3 Commands to Issue Example

user krissyj
pass Xiu$78g
list
retr 1
dele 1
retr 2
dele 2
quit

strict RFC smtp server syntax

Disallowing illegal syntax in MAIL FROM or RCPT TO commands. This may cause problems with home-grown applications that send mail, and with ancient PC mail clients. For this reason, the requirement is disabled by default ("strict_rfc821_envelopes = no").

  • Disallowing RFC 822 address syntax (example: "MAIL FROM: the dude <dude@example.com>").
  • Disallowing addresses that are not enclosed with <> (example: "MAIL FROM: dude@example.com").

use this syntax:

MAIL FROM:<marysue@hughes.net>
250 2.1.0 Ok
RCPT TO:<marysue@hughes.net>
554 5.7.1 <marysue@hughes.net>

With SMTP Authentication

  1. Base64 encoding is described in section 6.8 of RFC 2045.
  2. Users of the emacs editor can easily encode/decode base64 strings in the scratch buffer with the base64-encode-region and base64-decode-region commands.
  3. The openssl enc subcommand can also be used to encode and decode base64.
C: AUTH LOGIN
S: 334 VXNlcm5hbWU6
C: d2VsZG9u
S: 334 UGFzc3dvcmQ6
C: dzNsZDBu
S: 235 2.0.0 OK Authenticated

So you need to convert your username and password to Base64 encoding.

Here is a complete sample transaction:

220 smtp.b.hostedemail.com
HELO smtp.hughes.net
250 omf08.b.hostedemail.com
AUTH LOGIN
334 VXNlcm5hbWU6
pxFuaWXlaAB4dQuyZBNub9V0
334 UGFzc3dvcmQ6
K83NqwU9MA=a
235 2.0.0 Authentication successful
MAIL FROM:<jennys@hughes.net>
250 2.1.0 Ok
RCPT TO:<jennys@hughes.net>
250 2.1.5 Ok
Data
354 End data with <CR><LF>.<CR><LF>
BLAH BLAH BLAH
.
250 2.0.0 Ok: queued as 15668AD9ED
QUIT
221 2.0.0 Bye
Last modified on 1 July 2008, at 15:23