I'm using the smtp component to send out emails both via smtp relays and also directly via mxlookup. The latter is only used in those cases where the server is on a fixed ip and it's own MX records point to that IP so spam filters aren't an issue. We have one problem when sending out directly (mxlookup): If there are two or more recipients in the email we send the email to each of the recipient mx servers by modifying the mailman.SmtpHost property in turn. But when we call SendEmail the target smtp server gets ALL the recipients of the email as the RCPT TO: Envelope recipients and of course rejects those addresses that aren't in the domain of that server. Q: Is there a way to send an email to a specific recipient only WITHOUT modifying the TO:, CC:, etc. mail headers? We need to preserve the headers as they are with all the recipients in.
Call the SendMime method instead of SendEmail. The SendMime method allows you to pass the MIME in one argument, and the "RCPT TO" addresses in another argument.
Also, the mailman.SendEmail method is equivalent to the following (pseudo-code)
mimeStr = mailman.RenderToMime(emailObject); success = mailman.SendMime(fromAddr, recipients, mimeStr);