Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delivery of mail to multiple "to" addresses when one address is invalid #20

Closed
heikkiorsila opened this issue May 27, 2020 · 3 comments
Closed

Comments

@heikkiorsila
Copy link

heikkiorsila commented May 27, 2020

Server A is using msmtp for mail forwarding to another server B where postfix relays the mail forward. The postfix is configured to reject emails with some criteria, e.g.:

smtpd_recipient_restrictions =
       reject_non_fqdn_recipient,
       reject_unknown_recipient_domain,
       check_recipient_access hash:/etc/postfix/recipient_access

If server A sends email with multiple "To" addresses but one of them does not pass the checks at postfix on server B, then none of the "To" address will receive email. At least the valid email addresses should get delivered. Is there an option that we can use to send email separately to "To" specified addresses or handle this in other way? Please advice how to fix this..

Normally, we would try to avoid sending email to bad addresses, but this is a customer system where they may enter bad email addresses (accidently).

@marlam
Copy link
Owner

marlam commented May 27, 2020

There is no builtin option to "split" a mail and send for each recipient individually.
But you could implement this with a script that handles the mail before msmtp does: read the mail, extract all recipients, call msmtp for each recipient individually, passing the recipient on the command line and avoiding -t/--read-recipients.

@heikkiorsila
Copy link
Author

Thanks for a quick reply, Martin! Is it possible to receive feedback from msmtp about which email addresses where rejected or which were valid if we send to multiple addresses at once?

@marlam
Copy link
Owner

marlam commented May 29, 2020

Msmtp prints information about where in the SMTP session an error occurred, and what the error message given by the SMTP server was.

So I would expect a message like recipient address %s not accepted by server: <MESSAGE-FROM-SERVER>.

However, what you get depends on the SMTP server. It may chose to reject the mail only after all RCPT TO commands have been accepted, and then just give a generic error code and no detailed message.

Postfix typically gives you detailed information.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants