-
-
Notifications
You must be signed in to change notification settings - Fork 464
Description
As a rule of thumb: before reporting an issue
Describe the bug
When a SMTP relay service is configured on the host (eg, MailJet, DuoCircle), forwarded mails are rejected.
This is because the Dovecot LDA configuration does not rewrite the envelope sender, and the SMTP relay service rejects it because the envelope sender is not a permitted domain.
System information
- Froxlor version: 2.2.1-1
- Web server: N/A
- DNS server: N/A
- POP/IMAP server: Dovecot
- SMTP server: postfix
- FTP server: N/A
- OS/Version: Ubuntu 22.04
To Reproduce
Steps to reproduce the behavior:
- Configure postfix using a SMTP relay service. (Example: set
relayhost = [outbound.mailhop.org]:25
inmaster.cf
) - Setup an email forward. (Example:
info@mydomain.com -> someuser@gmail.com
) - Attempt to send email to
info@mydomain.com
from some other address. (Example:otheruser@yahoo.com -> info@mydomain.com
) - Relay host will reject email since it sees
otheruser@yahoo.com -> someuser@gmail.com
as envelope sender/receiver and rejects the mail since the envelope senderotheruser@yahoo.com
is not configured with the service.
Expected behavior
I expect the relay host to accept the mail being forwarded.
Logfiles
See attached.
Additional context
The solution is to have dovecot rewrite the envelope sender.
Change master.cf
from this:
dovecot unix - n n - - pipe flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient}
to this:
dovecot unix - n n - - pipe flags=DORhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient}
The -f
option rewrites the envelope sender, and the O
flag adds an X-Original-To
header. The original From:
header is preserved.
Under this configuration, when a mail is forwarded, the SMTP relay service sees info@mydomain.com -> someuser@gmail.com
and accepts the email, since mydomain.com
is configured with the SMTP relay service.