Email sender does not match notification email and I can't figure out why

I’m trying to use https://emailit.com/ on a forum that’s been up for 7 years or so (currently using mailgun). Email It is refusing to send because

 530 From header does not match MAIL FROM address

When I look at the email source on messages sent through Mailgun, I see that there is a "Sender: " line like “Sender: admin=example.com@www.example.com”. I don’t see this line on other test messages on other forums.

If I remove all plugins, the problem persists.

If I wipe the database, the problem goes away.

When I restore the database, the problem comes back.

I’ve tried searching custom texts and settings. I’ve done a postgres query of all fields in the database looking for “admin=www” and a couple of other things (at least AI said it did, and it seemed credible).

I tried adding a put to see what message was getting passed to the thing that sends email (it was yesterday and I forgot the names of the classes). I haven’t seen an explanation there.

I’m stumped.

Any ideas on where to check next will be appreciated.

The Sender: is something different. The error you’re getting indicates a discrepancy between the “envelope” (RFC821 From address) and the “From:” header (RFC822)

I suspect that emailit (or maybe Discourse, we’ve been rolling our own mail servers for too long) is setting the envelope sender to the email address you’re authenticating with.

I think (!) you should make sure that notification_email and DISCOURSE_SMTP_USER_NAME are the same for emailit.

1 Like

Thanks very much!

I was afraid of that. I’m much less familiar with RFC822 than I was 30 years ago. I know that "From " and "From: " and "Sender: " are all things, but not much more than that anymore.

Maybe this will be the year that I do that. Email seemed much easier when I had to port Sendmail and UUCP to linux than it does now. :slight_smile:

Seemed promising. No joy. Interestingly, emailit says that the SMTP_USER_NAME should be “emailit”.

But again, the SMTP stuff (including notification_emai) in app.yml worked just fine on this very same server with an empty database and stops when the database is restored.

1 Like

Discourse sets the envelope-from to the reply-by-email address.

1 Like

EVEN IF reply-by-email is disabled! :person_shrugging: :crying_cat_face:

I saw that something was there (it didn’t seem like it matched what I was seeing?), but thought since reply-by-email was disabled it wouldn’t matter.

OMG. Thank you so much! :rocket: :tada:

2 Likes

The reply-by-email address is critical for bounce detection on outgoing emails :+1:

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.