-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6dbc91a
commit 3da8258
Showing
4 changed files
with
483 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[package] | ||
name = "smtp" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
chrono = "0.4.37" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
In a typical session, SMTP dialog works as follows: | ||
- The client first establishes connection to the SMTP server. | ||
- The server initiates with a greeting. This greeting indicates that the server is ready to receive commands. | ||
- The client then issues its own greeting. | ||
- Server responds. | ||
- the client sends a command indicating who the mail is from. | ||
- The server responds to indicate that the sender is accepted. | ||
- The client issues anaother command, which specifies the mail recipient. | ||
- The server responds indicating the recipient is accepted. | ||
- The client then issues a DATA command. | ||
- The server responds asking the client to proceed. | ||
- The client transfers the email. | ||
|
||
Example: | ||
S: 220 mail.example.com SMTP server ready | ||
C: HELO mail.example.net | ||
S: 250 Hello mail.example.net [192.0.2.67] | ||
C: MAIL FROM:<alice@example.net> | ||
S: 250 OK | ||
C: RCPT TO:<bob@example.com> | ||
S: 250 Accepted | ||
C: DATA | ||
S: 354 Enter message, ending with "." on a line by itself | ||
C: Subject: Re: The Cake | ||
C: Date: Fri, 03 May 2019 02:31:20 +0000 | ||
C: | ||
C: Do NOT forget to bring the cake! | ||
C: . | ||
S: 250 OK | ||
C: QUIT | ||
S: 221 closing connection | ||
|
||
The common client commands we use are as follows: | ||
HELO is used for the client to identify itself to the server. | ||
MAIL is used to specify who is sending the mail. | ||
RCPT is used to specify a recipient. | ||
DATA is used to initiate the transfer of the actual email. This email | ||
should include both headers and a body. | ||
QUIT is used to end the session. | ||
|
||
The server response codes used in a successful email transfer are the | ||
following: | ||
220: The service is ready | ||
250: The requested command was accepted and completed successfully | ||
354: Start sending the message | ||
221: The connection is closing | ||
Error codes vary between providers, but they are generally in the 500 range. |
Oops, something went wrong.