200 likes | 410 Vues
SMTP. Simple Mail Transfer Protocol. RFC 821. Defines SMTP Written 1982 Objective: "to transfer mail reliably and efficiently" Sender establishes two-way communication with receiver Sender send the MAIL command. If receiver can receives, sends the OK command
E N D
SMTP Simple Mail Transfer Protocol
RFC 821 • Defines SMTP • Written 1982 • Objective: "to transfer mail reliably and efficiently" • Sender establishes two-way communication with receiver • Sender send the MAIL command. • If receiver can receives, sends the OK command • Sender specifies the recipient with RCPT command • Sender sends data with DATA command • Terminates with special sequence
Client Design • Mail port almost always on port 25 (sometimes moved for security reasons) • Open up socket • Have threaded reader from socket • Write commands using correct protocol • Note: ComMAnDs Are NoT CASe SensITiVE
HELO • HELO <domain> • Identifies the name of the sender • Replies with OK • Not checked for accuracy • Sometimes not required • Example: HELO bob.com
MAIL • Used to initiate a mail transaction • MAIL FROM: <email_address_of_sender> • Once again, not checked for accuracy • Example: MAIL FROM: bob@bob.com
RCPT • Identifies the recipient of the mail • Multiple recipients are achieved by multiple uses of this command • RCPT TO: <email_address> • Example: RCPT TO: jonpreston@mail.clayton.edu
DATA • Represents the actual data to be sent to the receiver • Terminated with single period on a line by itself "<CRLF>.<CRLF>" • Can contain: • From: • To: • Subject: • Date: • Reply: • Received: • …
QUIT • It, uh… does… umm…
Reply Codes • 500 Syntax error, command unrecognized [This may include errors such as command line too long] • 501 Syntax error in parameters or arguments • 502 Command not implemented • 503 Bad sequence of commands • 504 Command parameter not implemented • 211 System status, or system help reply • 214 Help message [Information on how to use the receiver or the meaning of a particular non-standard command; this reply is useful only to the human user] • 220 <domain> Service ready • 221 <domain> Service closing transmission channel • 421 <domain> Service not available, closing transmission channel [This may be a reply to any command if the service knows it must shut down] • 250 Requested mail action okay, completed • 251 User not local; will forward to <forward-path> • 450 Requested mail action not taken: mailbox unavailable [E.g., mailbox busy] • 550 Requested action not taken: mailbox unavailable [E.g., mailbox not found, no access] • 451 Requested action aborted: error in processing • 551 User not local; please try <forward-path> • 452 Requested action not taken: insufficient system storage • 552 Requested mail action aborted: exceeded storage allocation • 553 Requested action not taken: mailbox name not allowed [E.g., mailbox syntax incorrect] • 354 Start mail input; end with <CRLF>.<CRLF> • 554 Transaction failed
Minimum Implementation • For workability, the following must be recognized by the server: • HELO • MAIL • RCPT • DATA • RSET • NOOP • QUIT
Goin' Old-School • A Telnet session provides simple socket functionality • Telnet to a server on port 25 to practice your SMTP commands! • Easy on UNIX, Windows messes up
NOOP • Does nothing, other than send back an OK command • Useful for debugging your sockets
VRFY • Used to verify an account exists • Can be a security risk
EXPN • Expand and return a list • Hard to find a server that supports this
RSET • Current mail transaction is to be aborted • Any information sent is to be discarded • Receiver must send OK