I have a background program that uses MailMan to send emails through different email servers, depending on the 'From' address. The first email that gets sent when the program starts works fine. When the next email goes through, even though I have used the 'Set ComFrom' command with the new email address, MailMan still uses the first email address when trying to authenticate with the server.
Specifically, the SmtpConn_sendMime_FROM value that is used by MailMan is from the first email, and is not updated with the new address. This will usually cause a '553 From address not verified' error, and the send will fail. If I stop and restart the program, the email will go through fine, but subsequent emails that use a different server will typically fail.
When I use the 'Get ComFrom' command, it does show the correct address. Is there something else I need to do to force MailMan to use the newest 'From' address for the authentication?
Here is the section of code that sets up and sends the email:
Here is a snippet of the return value from MailMan:
It turns out that the problem is with the SendEmail command. It apparently does not reset the fromAddr parameter that is used when the email is actually sent, once it has been initially set. I tried using both the "Set ComFrom" and "Set ComFromAddress" commands to no avail. Is there another command to set the fromAddr?
What finally did work, was to render the email to MIME, and then use the SendMime command, instead of the SendEmail command. This way I could force the fromAddr value to the correct email address, and it would authenticate correctly.