Skip to content

forwarded mail is rejected by SMTP relay services #1278

@memmerto

Description

@memmerto

As a rule of thumb: before reporting an issue

  • see if it hasn't been reported (and possibly already been fixed) first
  • try with the git master

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:

  1. Configure postfix using a SMTP relay service. (Example: set relayhost = [outbound.mailhop.org]:25 in master.cf)
  2. Setup an email forward. (Example: info@mydomain.com -> someuser@gmail.com)
  3. Attempt to send email to info@mydomain.com from some other address. (Example: otheruser@yahoo.com -> info@mydomain.com)
  4. 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 sender otheruser@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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions