Question:
We have created a newsletter application.
To send these letters we’re using the Chilkat mail component.
This is the code I use:
<font size=\"2\" face=\"courier\">
MailMan mailman = new MailMan();
mailman.UnlockComponent("…");
mailman.SmtpHost = mailserver;
Email email = new Email();
email.AddTo(aEntity.Email,aEntity.Email);
email.From = fromAddr;
email.BounceAddress = bounceAddress;
email.AddHeaderField("abc_nieuwsbrief","["+CurrentNewsletter.ToString()+"]");
email.AddHeaderField("abc_id1″,"["+kEntity.Code+"]");
email.AddHeaderField("abc_id2″,"["+aEntity.ID+"]");
email.SetHtmlBody(mail_body);
email.Subject = nieuwsbrievenEntity.subject;
if(mailman.SendEmail(email))
…
</font>
This works fine (even great) but a lot of the bounces do not return to the bounce address but to the “from address”. It is necessary that the bounces arrive at that particularly address so that we can add these to system.
Any thoughts, help about this?
Answer:
Setting the BounceAddress property effectively sets the "return-path" header field. It could be that some external mail servers are not bouncing to the "return-path" email address, which is the correct behavior.
There is an additional level of flexibility that can be achieved by using the SendMime method instead of SendEmail. The SendEmail method is equivalent to calling mailman.RenderToMime to "render" and email to the MIME text for sending, and then calling SendMime.
I’ll describe why SendMime introduces flexibility by describing a little about the SMTP protocol. When an SMTP client connects to the SMTP server, it says "hello", possibly authenticates, and then begins passing information about the email. The client sends a "MAIL FROM" command, followed by "RCPT TO" commands (one for each To/Cc/Bcc recipient), and finally by a DATA command to send the complete MIME text of the email. The argument to the "MAIL FROM"
command is typically the "From" email address found in the "From" header field of the email. The SendEmail method uses this for the "MAIL FROM" argument. However, by calling SendMime, you can specify a different "MAIL FROM" address. (A side note: BCC recipients are passed in the "RCPT TO" commands, but are not found in the email header.) So… if your emails are newsletters that are not intended to be replied to, you might experiment by using the Bounce address in either the From header field, or the "MAIL FROM" argument. (The arguments to the SendMime method are passed as the "MAIL FROM" and "RCPT TO" SMTP protocol arguments.)
Hope that helps!