Change 'from' server for outgoing messages
Hi.
I'm running mailman3 on a VPS. The hostname of the VPS is not the hostname that I'm using for mailman3. The webapp is using an Apache Virtual host. I am routing outgoing emails through a third-party smtp relay. The VPS hostname is smart.bnmng.com and the mailing list hostname is 757pug.org
Signup confirmation and welcome emails are working. They appear to be coming from the intended host, which is 757pug.org
But emails from the mailing lists are being blocked by the smtp relay. I think it's because they are not coming from 757pug.org; They are coming from smart.bnmng.com
All of the mailinglists' mail_host fields are correct, 757pug.org
from mailman.cfg:
incoming: mailman.mta.postfix.LMTP outgoing: mailman.mta.deliver.deliver lmtp_host: 127.0.0.1 lmtp_port: 8024 smtp_host: smtp.mailersend.net smtp_port: 587 smtp_secure_mode: starttls smtp_user: (my relay service username) smtp_pass: (my relay service password)
from settings.py: DEFAULT_FROM_EMAIL = 'admin@757pug.org' SERVER_EMAIL = 'admin@757pug.org' EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend' EMAIL_HOST = 'smtp.mailersend.net' EMAIL_USE_TLS = True EMAIL_PORT = 587 EMAIL_HOST_USER = (my relay service username) EMAIL_HOST_PASSWORD = (my relay service password)
So it seems like mailman core is not using the mail_host field. How can I fix that?
Thank you
On 3/11/23 08:18, Benjamin Goldberg wrote:
Signup confirmation and welcome emails are working. They appear to be coming from the intended host, which is 757pug.org
Welcome messages are sent from Mailman core the same way as posts.
But emails from the mailing lists are being blocked by the smtp relay. I think it's because they are not coming from 757pug.org; They are coming from smart.bnmng.com
Assuming the Mailman core list name is xxx@757pug.org, Mailman will send both posts and welcome messages with envelope from xxx-bounces@757pug.org if not VERPed or if VERPed, xxx-bounces+user=example.com@757pug.org. The only difference is the From: header. for a welcome message the From: address is xxx-request@757pug.org. For a post if the list is anonymous or if DMARC mitigations are applied the From: address is xxx@757pug.org. Otherwise it is the From: address of the incoming post.
For failures from the smtp relay, there should be messages in Mailman's smtp.log of the form:
$msgid delivery to $recip failed with code $smtpcode, $smtpmsg
with the appropriate substitutions. What are the error messages in these entries.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Well, this is interesting. Based on your reply, I stopped trying to figure out any difference between the admin messages and the posts. Instead I removed the settings which routed the outgoing messages through MailerSend. That worked. I received both a welcome message and a post from a list I created just for this test. Then I restored the settings, and it still worked! Without the external routing, my messages ended up in spam but at least they were delivered. Routed through MailerSend they get delivered to my inbox.
I'll do some more testing because this all seems strange and I'm not convinced it's fixed.
BTW the errors that I had been getting were, at first: response exception: (450, b'The from.email must be verified. The from.email must be verified.') but later changed to: response exception: (450, b'Sorry, please try again. 429 Too many requests.')
I had assumed both errors were being generated by MailerSend but now I'm not sure
I'm not sure it's fixed but if not, I'm certainly closer. Thank you
On 3/11/23 16:44, Benjamin Goldberg wrote:
BTW the errors that I had been getting were, at first: response exception: (450, b'The from.email must be verified. The from.email must be verified.') but later changed to: response exception: (450, b'Sorry, please try again. 429 Too many requests.')
I had assumed both errors were being generated by MailerSend but now I'm not sure
Yes, they are from your smtp_host which was mailersend
Both those are retryable and will be retried by Mailman to a point. I suggest if you want to use mailersend that in Postorius DMARC Mitigations you set DMARC mitigation action to Replace From: with list address and DMARC Mitigate unconditionally to yes.
That will ensure all posts are From: the list address and will probably avoid the 'The from.email must be verified. The from.email must be verified.' error.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
participants (2)
-
Benjamin Goldberg
-
Mark Sapiro