SMTP Technicalities and Perl
This is a rather technical question that I hope someone has an answer to. I've been writing a Perl program using the Net:
Now, once connected to an SMTP server, you first send a MAIL command with the sender's address. You then send a series of RCPT commands with each of the receivers' e-mail addresses. After this, you send a stack of data that makes up the e-mail message.
Now, in that data you have the standard headers (info in RFC822, above). These are your standard To, From, Subject headers etc that you often use with sendmail in Perl scripts (and that you often use for a lot of other things of course). For example:
From: me@here.com
To: me@there.com
Subject: Hello
Each of the addresses in the To header is supposed to be converted into a RCPT command.
Now, the problem is this. When I send, the SMTP requires that I send a MAIL and RCPT command before rattling off with the From and To headers. So I send MAIL, send RCPT, then send my headers, but the headers override what I sent initially in MAIL and RCPT (so what was in To overrides RCPT, and what was in From overrides MAIL).
I've got no problem with that, in fact I prefer it that way (because I want to send all the data in headers rather than in separate MAIL and RCPT commands). The thing is that the initial commands seem necessary, but pointless, as they just get overridden.
Does anyone know of the technicalities of this? Are MAIL and RCPT supposed to be overridden, or am I missing something? Are they not actually overridden but serve another purpose?