Jean-Paul Passama wrote:
Know that, but you don't explain how to indicate a CC: receiver.

OK, it's time for another crash course in the SMTP transport.

The "TO", "CC", and "BCC"--and for that matter, all headers--are just informational for the Mail Client. As far as the SMTP protocol knows, the message payload is composed of a very large string which includes the headers, body, attachments, and all other mime parts. The receiving client application makes a distinction between the body and the headers and the various parts, but for the transport doesn't know nor cares.

Now, there is an "envelope" tied to each SMTP message, which indicates to the server the actual sender and the recipients. These are sent as part of the "MAIL FROM" and "RCPT TO" commands, respectively, prior to the message data. In the case of the sender, only one is allowed, and the server will use that to compose routing information in case the message needs to be bounced. Some servers also use it to verify relay access. On the other hand, the "RCPT TO" command can be sent multiple times, once for each recipient.

Thus, when you send a message via SMTP, your application prepares a list of all the recipients--ALL OF THEM--including the "TO", "CC" and "BCC" recipients. This list is sent to the SMTP server, one by one, using the "RCPT TO" command.

So what are the headers for, then? Like I said, for the receiving mail client to see, nothing more (there are some exceptions, but they do not apply to this explanation). The "primary" recipient customarily is put in the "TO" header, additional recipients are put in the "CC" header, and the "BCC" is not even included (the idea is that the other recipients never sees them!).

And how does this work with ICS TSmtpClient? The first thing you must understand is that the component encapsulates the SMTP protocol--the transport--not a Mail Client; that is the job of your application. That means that your application needs to take care of all recipients and headers itself.

Your application can keep its own list of "TO", "CC", and "BCC", and then set the HdrTo and HdrCC fields in the TSmtpClient component so that they show up in the e-mail headers (you do not include the "BCC" in the headers, of course!), but it must also add them to the actual recipient list by calling RcptNames.Add() for each one.

For more information on how to do this, as Arno said before, check out the OverbyteIcsMailSnd demo program.

I hope this explains how it works.

        dZ.

--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to