========================================== sample SMTP session using the "nc" command ========================================== -Ian! D. Allen - idallen@idallen.ca The "nc" TCP/IP "Swiss Army Knife" program is a "pure" way to connect your keyboard with a remote TCP/IP daemon. It is similar to "telnet", except it doesn't try to auto-negotiate any line parameters first. It is useful for connecting directly to many text-based Internet protocols. One such protocol is the Simple Mail Transfer Protocol (SMTP) used to send EMail over the Internet. This protocol is only used for *sending* email, not for receiving email. It is documented in RFC2821: http://www.faqs.org/rfcs/rfc2821.html My input is marked by "*" in the examples below. This particular SMTP server has all the HELP commands enabled. Compare this session with the session on text ALN p.483: (ALN: course text "Advanced Linux Networking" by Roderick W. Smith) * $ nc -v mailgate6.algonquincollege.com smtp mailgate6.algonquincollege.com [205.211.41.151] 25 (smtp) open 220 mailgate6.algonquincollege.com ESMTP Sendmail Switch-3.1.7/Switch-3.1.7; Wed, 16 Feb 2005 08:56:41 -0500 (EST) * HELP 214-2.0.0 This is sendmail version Switch-3.1.7 214-2.0.0 Topics: 214-2.0.0 HELO EHLO MAIL RCPT DATA 214-2.0.0 RSET NOOP QUIT HELP VRFY 214-2.0.0 EXPN VERB ETRN DSN AUTH 214-2.0.0 STARTTLS 214-2.0.0 For more info use "HELP ". 214-2.0.0 To report bugs in the implementation send email to 214-2.0.0 sendmail-bugs@sendmail.org. 214-2.0.0 For local information send email to Postmaster at your site. 214 2.0.0 End of HELP info * HELP EHLO 214-2.0.0 EHLO 214-2.0.0 Introduce yourself, and request extended SMTP mode. 214-2.0.0 Possible replies include: 214-2.0.0 SEND Send as mail [RFC821] 214-2.0.0 SOML Send as mail or terminal [RFC821] 214-2.0.0 SAML Send as mail and terminal [RFC821] 214-2.0.0 EXPN Expand the mailing list [RFC821] 214-2.0.0 HELP Supply helpful information [RFC821] 214-2.0.0 TURN Turn the operation around [RFC821] 214-2.0.0 8BITMIME Use 8-bit data [RFC1652] 214-2.0.0 SIZE Message size declaration [RFC1870] 214-2.0.0 VERB Verbose [Allman] 214-2.0.0 CHUNKING Chunking [RFC1830] 214-2.0.0 BINARYMIME Binary MIME [RFC1830] 214-2.0.0 PIPELINING Command Pipelining [RFC1854] 214-2.0.0 DSN Delivery Status Notification [RFC1891] 214-2.0.0 ETRN Remote Message Queue Starting [RFC1985] 214-2.0.0 STARTTLS Secure SMTP [RFC2487] 214-2.0.0 AUTH Authentication [RFC2554] 214-2.0.0 ENHANCEDSTATUSCODES Enhanced status codes [RFC2034] 214-2.0.0 DELIVERBY Deliver By [RFC2852] 214 2.0.0 End of HELP info * EHLO idallen.ca 250-mailgate6.algonquincollege.com Hello cpu1808.adsl.bellglobal.com [206.47.37.39], pleased to meet you 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-8BITMIME 250-SIZE 250-DSN 250-ETRN 250-DELIVERBY 250 HELP * HELP MAIL 214-2.0.0 MAIL FROM: [ ] 214-2.0.0 Specifies the sender. Parameters are ESMTP extensions. 214-2.0.0 See "HELP DSN" for details. 214 2.0.0 End of HELP info * MAIL FROM: 250 2.1.0 ... Sender ok * HELP RCPT 214-2.0.0 RCPT TO: [ ] 214-2.0.0 Specifies the recipient. Can be used any number of times. 214-2.0.0 Parameters are ESMTP extensions. See "HELP DSN" for details. 214 2.0.0 End of HELP info * RCPT TO: 250 2.1.5 ... Recipient ok * HELP DATA 214-2.0.0 DATA 214-2.0.0 Following text is collected as the message. 214-2.0.0 End with a single dot. 214 2.0.0 End of HELP info * DATA 354 Enter mail, end with "." on a line by itself * From: idallen@idallen.ca * To: alleni@algonquincollege.com * Subject: test smtp mail * * hello * . 250 2.0.0 j1GDuf76028969 Message accepted for delivery * QUIT 221 2.0.0 mailgate6.algonquincollege.com closing connection $ Here is the EMail I received from the above SMTP exchange: Received: from idallen.ca (cpu1808.adsl.bellglobal.com [206.47.37.39]) by mailgate6.algonquincollege.com (Switch-3.1.7/Switch-3.1.7) with ESMTP id j1GDuf76028969 for ; Wed, 16 Feb 2005 08:57:50 -0500 (EST) Date: Wed, 16 Feb 2005 08:56:41 -0500 (EST) Message-id: <200502161357.j1GDuf76028969@mailgate6.algonquincollege.com> From: idallen@idallen.ca To: alleni@algonquincollege.com Subject: test smtp mail hello