SMTP Protocol
(sonet.all@gmail.com)
1. Find MX Record
nslookup
> set q=mx
> program.com.tw
Server: 127.0.1.1
Address: 127.0.1.1#53
Non-authoritative answer:
program.com.tw mail exchanger = 5 se2.program.com.tw.
program.com.tw mail exchanger = 10 mail.program.com.tw.
<
nslookup -q=mx yahoo.com
nslookup -q=mx google.com
2. SMTP Protocol (Simple Mail Transfer Protocol)
b. Example of the SMTP Procedure
S: EHLO program.com.tw
R: 250-se2.program.com.tw
250-PIPELINING
250-8BITMIME
250 SIZE 52428800
S: MAIL FROM:
R: 250 OK
S: RCPT TO:
R: 250 OK
S: RCPT TO:
R: 504 Authentication failed for SMTP service. --> (system logout)
S: RCPT TO:
R: 550 User (test_account@program.com.tw) unknown.
S: DATA
R: 354 Start mail input; end with
From: luke@program.com.tw
To: TEST
Subject: [測試信件]
Content-Type: text/plain; charset="utf-8"
您好,
=============================================
. <-- n.="" n="" r="" span="">-->
R: 250 OK
3. MIME(Multipurpose Internet Mail Extensions)
MIME-Version: 1.0
Received: by 10.52.168.69 with HTTP; Wed, 17 Apr 2013 20:07:28 -0700 (PDT)
Date: Thu, 18 Apr 2013 11:07:28 +0800
Delivered-To: sonet.all@gmail.com
Message-ID:
Subject: for demo
From: =?UTF-8?B?6Jab5YWx5ZKMKGx1a2Up?=
To: =?UTF-8?B?6Jab5YWx5ZKMKGx1a2Up?=
Content-Type: multipart/mixed; boundary=
--20cf307cfbe2188ff404da99e72b
Content-Type: multipart/alternative; boundary=20cf307cfbe2188ff004da99e729--20cf307cfbe2188ff004da99e729
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: base64
5ris6Kmm5aS+5qqUDQoNCi0tIA0KDQp+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+DQogICBCMkMg6Zu75a2Q55m856WoIOWKoOWAvOacjeWLmeS4reW/gyAgKOW+rueoi+W8j+acg+WToSkNCg0KTGlmZSsg6IGw5piO5oiR55qE5raI6LK755Sf5rS777yBaHR0cDovL3d3dy5saWZlcGx1cy50dw0Kfn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fg0K--20cf307cfbe2188ff004da99e729
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: base64
PGRpdiBkaXI9Imx0ciI+PGRpdj48YnI+PC9kaXY+5ris6Kmm5aS+5qqUPGJyIGNsZWFyPSJhbGwiPjxkaXY+PGJyPjwvZGl2Pi0tIDxicj48ZGl2Pjxicj48L2Rpdj48ZGl2Pn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn48L2Rpdj48ZGl2PsKgIMKgQjJDwqDpm7vlrZDnmbznpagg5Yqg5YC85pyN5YuZ5Lit5b+DIMKgKOW+rueoi+W8j+acg+WToSnCoDwvZGl2PjxkaXY+PGJyPjwvZGl2PjxkaXY+TGlmZSsg6IGw5piO5oiR55qE5raI6LK755Sf5rS777yBPGEgaHJlZj0iaHR0cDovL3d3dy5saWZlcGx1cy50dy8iIHRhcmdldD0iX2JsYW5rIj5odHRwOi8vd3d3LmxpZmVwbHVzLnR3PC9hPjwvZGl2Pg0KPGRpdj5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+fn5+PC9kaXY+DQo8L2Rpdj4NCg==--20cf307cfbe2188ff004da99e729--
--20cf307cfbe2188ff404da99e72b
Content-Type: application/octet-stream; name="=?UTF-8?B?5ZyW6KGoMS5kaWF+?="
Content-Disposition: attachment; filename="=?UTF-8?B?5ZyW6KGoMS5kaWF+?="
Content-Transfer-Encoding: base64
X-Attachment-Id: f_hfncm3cs0
H4sIAAAAAAACA+1dzXLbRhK++ylYzHGVEeZ/JoqdchSn4qqN44qVbDYXFURCFDYQoAUh2/JhL3vdF9in2Lfa2sfY6RnKFklAIgkMTNjDVBKTHk5jwO4PX/f0dH/9zdvLbPQ6KedpkT8eYxSNR0k+KaZpPns8/uXk+y/V+Jsnj76epvFX5t9ZGV+OzDf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QgZBiER5h5ZlxHCnBRgXcT8USPBfTKjtsvahBtJJJefAAA=--20cf307cfbe2188ff404da99e72b--
4. Mail to another host or mail to gmail
a. MTA (Message transfer agent)
# perl -MMIME::Base64 -e 'print encode_base64("steveweb")'
c3RldmV3ZWI=
# perl -MMIME::Base64 -e 'print encode_base64("123")'
MTIz
S: EHLO program.com.tw
R: 250-mail.program.com.tw
250-PIPELINING
250-8BITMIME
250-AUTH=LOGIN
250-AUTH LOGIN
250-STARTTLS
250 SIZE 1004288000
S: AUTH LOGIN
R: 334 VXNlcm5hbWU6
S: c3RldmV3ZWI=
R: 334 UGFzc3dvcmQ6
S: MTIz
R: 235 Authentication successful.
S: mail from: steveweb@program.com.tw <- span="">->
R: 250 Sender <steveweb@program.com.tw> OK
S: rcpt to: sonet.all@gmail.com <- span="">->
R: 250 Recipient <sonet.all@gmail.com> OK
S: data
R: 354 Start mail input; end with
From: luke@program.com.tw
To: TEST
Subject: [測試信件]
Content-Type: text/plain; charset="utf-8"
您好,
=============================================
. <-- n.="" n="" r="" span="">-->
QUIT
b. Secure SMTP over Transport Layer Security
The following dialog illustrates how a client and server can start a
TLS session:
S:
C:
S: 220 mail.imc.org SMTP service ready
C: EHLO mail.example.com
S: 250-mail.imc.org offers a warm hug of welcome
S: 250-8BITMIME
S: 250-STARTTLS
S: 250 DSN
C: STARTTLS
S: 220 Go ahead
C:
C & S:
C & S:
C: EHLO mail.example.com
S: 250-mail.imc.org touches your hand gently for a moment
S: 250-8BITMIME
S: 250 DSN
No comments:
Post a Comment