On 03/27/02 at 16:40, Michael Davis wrote:

> Hi all,
> I'm educating myself on the raw SMTP commands.

The RFCs are always an enlightening read on the subject...  ;-)

> Using telnet, I've had success sending to one recipient using:
> 
> telnet mail.domain.com 25
> HELO domain.com
> EHLO domain.com

Only one of HELO or EHLO is needed. EHLO tells the remote server that you
wish to use extended SMTP commands. In its response to an EHLO, the server
should tell you which extended commands it supports. Also, the argument to
the HELO/EHLO command should be _your_ host name, not the domain of the
server you've connected to.

> MAIL FROM: [EMAIL PROTECTED]
> RCPT TO: [EMAIL PROTECTED]
> DATA To: [EMAIL PROTECTED]

The proper command is simply

DATA

The server will respond to tell you to go ahead and send the data, ending
it with a . on a line by itself (IOW, <CR>.<CR>)

> From: [EMAIL PROTECTED]
> CC: [EMAIL PROTECTED]
> Subject: Hello there

These are not SMTP commands. The receiving server will consider them to be
part of the message body and not even look at them (unless it does some
sort of content filtering, but that would be above and beyond the SMTP
protocol).

> This is the message.
> ..

The message (i.e., the DATA portion of the conversation) is ended with
<CR>.<CR>. '..' doesn't do it.

> RSET

You should issue an RSET command immediately following the initial HELO or
EHLO command, not at the end of the session. IIRC, RSET is technically
required to be the next command after HELO/EHLO, but most servers won't
choke of it's not.

> QUIT
> 
> 
> Question: How do I create a message, or send commands that will 
> send to multiple recipients using CC and BCC headers?

By issuing multiple RCPT TO: commands. They, not the headers, define the
message's envelope recipients.

> Is this done by the mail agent when communicating with the SMTP
> server,

Yes.

> or is this done on the server end while parsing headers in the DATA
> stream?

The server does not parse headers in the DATA stream, it only acts on SMTP
commands. I.e., the 'MAIL FROM:' and 'RCPT TO:' commands constitute the
message's 'envelope' information.

> In the example above, for instance, the CC: header is ignored and
> only the recipient in the RCPT TO: field is sent the message.

Yes. Think of it like snail mail. The Postal Service only delivers letters
to the recipient shown on the envelope. They don't know, or care, whether
the letter inside the envelope has a CC line that lists other recipients.
The 'RCPT TO:' is the envelope recipient. Any message header lines (To:,
CC:, BCC:, etc.) are _inside_ the message body and don't affect the
delivery of the message.

> It makes sense that an SMTP server should not parse mail headers in
> the DATA, but it does seem to add a Date: header, which leads me to
> believe that there is some degree of parsing of the DATA going on.

The server may add headers that give information about the SMTP session
(most notably 'Received:' headers), but it shouldn't add anything that's
the result of parsing anything in the message body (which includes the
headers)

[Someone with more thorough knowledge of SMTP may very well jump in and
correct me on any of these points...]

-- 
                   Christopher Bort | [EMAIL PROTECTED]
            Webmaster, Global Homes | [EMAIL PROTECTED]
      <http://www.globalhomes.com/> | PGP public key available on request

#############################################################
This message is sent to you because you are subscribed to
  the mailing list <[EMAIL PROTECTED]>.
To unsubscribe, E-mail to: <[EMAIL PROTECTED]>
To switch to the DIGEST mode, E-mail to <[EMAIL PROTECTED]>
To switch to the INDEX mode, E-mail to <[EMAIL PROTECTED]>
Send administrative queries to  <[EMAIL PROTECTED]>

Reply via email to