שולח האימייל לא תואם את אימייל ההודעה ואני לא מצליח להבין מדוע

סיכום מבוסס בינה מלאכותית

The discussion revolves around an issue with Email sender does not match notification email. pfaffman is trying to use https://emailit.com/ on a forum, but it’s refusing to send emails due to a “From header does not match MAIL FROM address” error. After troubleshooting, RGJ suggested that the issue might be due to a discrepancy between the “envelope” (RFC821 From address) and the “From:” header (RFC822).

pfaffman tried setting notification_email and DISCOURSE_SMTP_USER_NAME to the same value, but it didn’t work. However, supermathie revealed that Discourse sets the envelope-from to the reply-by-email address. pfaffman discovered that this was the cause of the issue, even if reply-by-email is disabled. supermathie explained that the reply-by-email address is critical for bounce detection on outgoing emails.

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.

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.

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

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:

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