3. Basic Mail
The basic command for transmitting mail is MAIL. This command causes the transmitted data to be entered into the recipient's mailbox, or accepted for relaying to the destination host.
The mail text is also sent on the transmission channel. This requires that the end of the text be signalled so that the command and reply dialog can be resumed. MTP signals the end of the mail text by sending a line containing only a period. A transparency procedure is used to prevent this interfering with the users text (see Section 5.5.2).
MAIL <SP> FROM:<sender-path> <SP> TO:<receiver-path> <CRLF>
The <sender-path> contains the source mailbox; the <receiver-path> contains the destination mailbox. If accepted, the receiver-MTP returns a 354 reply and considers all succeeding lines to be the message text. The message text is terminated by a line containing only a period, upon which a 250 completion reply is returned. Various errors are possible.
Actually the <sender-path> and <receiver-path> are more than just the mailboxes, they may be source routes. The <receiver-path> is a source routing list of hosts and destination mailbox; the <sender-path> is a reverse source routing list of hosts and source mailbox.
Example of MAIL (Basic Mail)
This MAIL command specifies the mail is sent by Waldo at host A,
and is to be delivered to Foo at host Y. Here we assume that host
A contacts host Y directly.
S: MAIL FROM:<waldo@A> TO:<Foo@Y> <CRLF>
R: 354 Start mail input; end with <CRLF>.<CRLF>
S: Blah blah blah blah....etc. etc. etc.
S: <CRLF>.<CRLF>
R: 250 Mail sent
The mail text has now been sent to "Foo".
Example 1
3.1. Forwarding
There are two possible preliminary replies that a receiver may use to indicate that it is accepting mail for a user whose mailbox is not at that host.
151 User not local; will forward to <user>@<host>
This reply indicates that the receiver-MTP knows the user's mailbox is on another host and will take responsibility for forwarding the mail to that host. This reply is only sent when the sender would not expect the mail to be forwarded. That is, when <receiver-path> as given in the command indicates mail relaying, this reply will not be used. This reply could be used for an organization with several hosts when each has a list of many of the users on the hosts. A host can accept mail for any user on its list and forward it to the correct host.
152 User Unknown; mail will be forwarded by the operator
This reply indicates that the host does not recognize the user name, but that it will accept the mail and have the operator attempt to deliver it. This is useful if the user name is misspelled, but may be a disservice if the mail is really undeliverable.
If forwarding by the operator is unacceptable or if the sending-user would prefer to send the mail directly to the recipient's actual host, the action may be aborted.
The MTP-sender must accept or reject the proposal in the preliminary reply by sending a continue (CONT) or abort (ABRT) command. In the case of the continue, the next reply from the MTP-receiver will be any of the replies expected for the MAIL command, most likely "354 Start mail input, ...". In the case of the abort, the next reply from the MTP-receiver will be "201 Command okay, action aborted".
3.2. Source Routing
The receiver-path may be a source route of the form "@ONE,@TWO,JOE@THREE", where ONE, TWO, and THREE are hosts. This form is used to emphasize the distinction between an address and a route.
At some distant future time it might be necessary to expand the mailbox format to include a region identifier, such as "user@host@region". If this occured the MTP path convention could be expanded to "host@region,host@region,...user@host@region". For example, "ONE@R1,TWO@R2,JOE@THREE@R3".
The mailbox is an absolute address, and the route is information about how to get there. The two concepts should not be confused.
The elements of the receiver-path are to be moved to the sender-path as the message is relayed from one MTP to another. The sender-path is a reverse source route, that is, a source route to the originator of the message. When an MTP deletes its identifier from the receiver-path and inserts it into the sender-path, it must use the name it is known by in the environment it is sending into, not the environment the mail came from, in case the MTP is known be different names in different environments.
When source routing is used the receiver-MTP will receive mail to be relayed to another MTP. The receiver-MTP may accept the task of relaying the mail or reject it in the same way it accepts or reject mail for a local user. It does not use the 151 "User not local" or 152 "User unknown" preliminary replies. Once the receiver-MTP accepts the relaying task it receives the mail text and transforms the command arguments by removing its own identifier from the receiver-path and inserting it in the beginning of the sender-path. The receiver-MTP then becomes a sender-MTP and establishes a transmission channel to the next MTP in the receiver-path and sends it the mail.
If an MTP has accepted the task of relaying the mail and later finds that the receiver-path is incorrect or that the mail cannot be delivered for whatever reason, then it must construct a notification message and send it to the originator of the undeliverable mail as indicated by the sender-path. This notification message must be from the MTP at this host. That is, the sender-path of the notification message itself will be "MTP@<host>", and in the notification message header the From field will be "MTP at <host>". Of course, MTPs should not send notification messages about problems with notification messages.