Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In SMTP, must the RCPT TO: and TO: match?

When sending an email, the recipient list is given during the SMTP dialogue through RCTP TO: command. Later, in DATA command, header fields like 'To', 'Cc','bcc' are indicated. Does this RCPT TO list of recipients have to match with the headers indicated in DATA command?

Also, if the recipient is not indicated in RCPT TO, but in the To field of email header, is it going to be delivered to the recipient not in RCPT TO?

like image 776
Jelena Avatar asked May 30 '12 18:05

Jelena


People also ask

What is Rcpt command in SMTP?

You can use the RCPT TO command only after a MAIL FROM command has been issued. If the host system has never heard of the recipient host, the RCPT TO command receives a negative reply. If a name server is used for domain name resolution, MX records are used to resolve the recipient IP address before trying A records.

What are SMTP headers?

This is the real recipient in the SMTP protocol. The message will be delivered to this recipient regardless of the message's To: header. An Email client displays the information from the message header, while the delivery of the message is given by the information in the SMTP protocol.


2 Answers

No, they don't have to match. When the message is sent, the SMTP Server (aka Message Transfer Agent or MTA) is creating a so called SMTP envelope which contains the recipients and the sender of the message (see RFC5321):

SMTP transports a mail object. A mail object contains an envelope and content. The SMTP envelope is sent as a series of SMTP protocol units (described in Section 3). It consists of an originator address (to which error reports should be directed), one or more recipient addresses, and optional protocol extension material.

It is, actually, quite often that the RCPT TO: Command has more recipients that the header of the message - one common case is the usage of "blind copies" bcc: (see RFC5321):

Addresses that do not appear in the message header section may appear in the RCPT commands to an SMTP server for a number of reasons. The two most common involve the use of a mailing address as a "list exploder" (a single address that resolves into multiple addresses) and the appearance of "blind copies".

like image 107
silentser Avatar answered Sep 25 '22 08:09

silentser


Does this RCPT TO list of recipients have to match with the headers indicated in DATA command?

Nope.

if the recipient is not indicated in RCPT TO, but in the To field of email header, is it going to be delivered to the recipient not in RCPT TO ?

The RCPT. Here's a (modified) transcript from my own SMTP client where I do just what you ask:

CLIENT: MAIL FROM:<[email protected]> SERVER: 250 2.1.0 OK  CLIENT: RCPT TO:<[email protected]> SERVER: 250 2.1.5 OK  CLIENT: DATA SERVER: 354  Go ahead  CLIENT: Subject: Test email CLIENT: From:'John Doe'<[email protected]> CLIENT: To:'John Doe'<[email protected]> CLIENT: This is a test... CLIENT: . 

The message was successfully sent to "[email protected]".

like image 41
james.garriss Avatar answered Sep 22 '22 08:09

james.garriss