login about faq

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:

Get IsComObjectCreated of oEmail to iCreated
If (not(iCreated)) Send CreateComObject of oEmail

Set ComSubject of oEmail to sSubject
Set ComBody    of oEmail to sBody
Set ComFrom    of oEmail to sFromAddress <--- This correctly sets the new email address

Set ComSmtpPassword   to sPW
Set ComSmtpUsername   to sUser
Set ComSmtpHost       to sServerAddress

Send ComDropAttachments of oEmail
Send ComClearTo         of oEmail
Send ComClearCC         of oEmail

Move (ComAddTo(oEmail,'',sToAddress)) to iRetVal

Get pvComObject of oEmail to vEmail
Move (ComSendEmail(Self,vEmail)) to iRetVal
Get ComLastErrorText to sReturn
Get ComCloseSmtpConnection to iRetVal

Here is a snippet of the return value from MailMan:

helloResponse: 250-smtp.mail.yahoo.com
250-PIPELINING
250-SIZE 41697280
250-8 BITMIME
250 AUTH PLAIN LOGIN XYMCOOKIE
login_method: LOGIN
CONNECTED to ESMTP server smtp.mail.yahoo.com:465
ConnectionType: SSL/TLS
checkOrMakeSmtpConnection: Elapsed time: 1156 millisec
SmtpConn_sendMime_FROM: support@omnipong.com <--- This address was from the previous email
553 From address not verified
Failed when sending MAIL FROM:<support@omnipong.com>
220 smtp.mail.yahoo.com ESMTP ready

asked Dec 16 '13 at 12:01

CraigK's gravatar image

CraigK
113

edited Dec 16 '13 at 14:50


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.

link

answered Dec 17 '13 at 13:32

CraigK's gravatar image

CraigK
113

edited Dec 17 '13 at 13:46

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×6

Asked: Dec 16 '13 at 12:01

Seen: 796 times

Last updated: Dec 17 '13 at 13:46

powered by OSQA