Ubuntu/Commands/Mail Server CLI/ESMTP
Commands | dig | Mail Server CLI
POP | IMAP | ESMTP
Contents |
ESMTP Overview
- ESMTP
- Extended Simple Mail Transport Protocol : Application layer internet standard protocol that uses TCP/IP.
Testing from a command line interface provides a virtually guaranteed way of confirming basic requirements for a successfully connection. Observations and responses observed come directly from the mail server rather than trying to interpret an application's translation of the scenario. Keep in mind that testing from a command line is generally in plain text, which is insecure, unless you use a connect application such as openssl
While much easier to test from a Linux terminal, it is possible to test from a windows command prompt, however, keep in mind that Windows does not allow you to backspace or delete any mistakes that you make. While unconfirmed, based on behavior it appears that Windows actively submits every keystroke to the mail server rather than waiting for "return".
ESMTP Commands
EHLO
- The required first command, is the introduction to the mail server. You can either list a FQDN or Email address. It also lists what commands the server has available for usage.
ehlo perimeterusa.com 250-esmail01.eservices.usa.net Hello perimeterusa.com [10.45.64.3], pleased to meet you 250-SIZE 52428800 250-STARTTLS 250-PIPELINING 250-8BITMIME 250 HELP
AUTH LOGIN
- Only used for mail servers that require authentication, this requires that the username and password be passed to the server in BASE64 encoding. openssl is capable of encoding/decoding text to BASE64. This step is not required if you are connecting with the recipient's mail exchanger directly, IE connecting to a gmail MX to deliver a message to a gmail recipient.
auth login 334 VXNlcm5hbWU6 dXNlcm5hbWU= 334 UGFzc3dvcmQ6 cGFzc3dvcmQ= 235 2.7.0 Authentication successful
MAIL FROM
- Specifies who is sending the message, but not necessarily the sender of the message. I will not go into detail as more information is readily available online.
mail from:<[email protected]> 250 2.1.0 Sender OK
RCPT TO
- Specifies who is receiving the message, but not necessarily the original recipient or CC. I will not go into detail as more information is readily available online.
rcpt to:<[email protected]> 250 2.1.5 Recipient OK
DATA
- This is where the message is inserted, everthing including internet headers, message body, & attachments.
data 354 Start mail input; end with <CRLF>.<CRLF> test . 250 2.6.0 <[email protected]> [InternalId=62880244] Queued mail for delivery
QUIT
- Fairly self explanatory, terminates your session with the server.
quit 221 2.0.0 Service closing transmission channel
Full Session Example
~$ telnet exchange.postoffice.net 25 Trying 165.212.120.200... Connected to exchange.postoffice.net. Escape character is '^]'. 220 exchange.postoffice.net Microsoft ESMTP MAIL Service ready at Fri, 12 Oct 2012 04:28:29 +0000 ehlo talladegaraceway.com 250-esmail01.eservices.usa.net Hello talladegaraceway.com [10.45.64.3], pleased to meet you 250-SIZE 52428800 250-STARTTLS 250-PIPELINING 250-8BITMIME 250 HELP auth login 334 VXNlcm5hbWU6 cmlja3lib2JieUB0YWxsYWRlZ2FyYWNld2F5LmNvbQ== 334 UGFzc3dvcmQ6 c2hha2VhbmRiYWtl 235 2.7.0 Authentication successful mail from:<[email protected]> 250 2.1.0 Sender OK rcpt to:<[email protected]> 250 2.1.5 Recipient OK data 354 Start mail input; end with <CRLF>.<CRLF> Received: from S1P5DAG2C.EXCHPROD.USA.NET ([169.254.2.236]) by S1P5HUB2.EXCHPROD.USA.NET ([10.120.223.32]) with mapi id 14.02.0247.003; Fri, 27 Apr 2012 23:29:55 +0000 From: "Ricky Bobby" <[email protected]> To: "Chaz Michael Michaels" <[email protected]> Subject: Shake & Bake Thread-Topic: Shake & Bake Thread-Index: Ac0kzaXj1SGKcXxTRU21ts6UZGL4Xw== Date: Fri, 27 Apr 2012 23:29:54 +0000 Message-ID: <3D4A65565EFB3D4B9A541F98D0DA17D7143C2010@S1P5DAG2C.EXCHPROD.USA.NET> Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Hello, Shake and Bake forever! The Iron Lotus sucks. Yours Truely, Ricky Bobby . 250 2.6.0 <[email protected]> [InternalId=62880244] Queued mail for delivery quit 221 2.0.0 Service closing transmission channel