-
Notifications
You must be signed in to change notification settings - Fork 17
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
Option to send mail to local addresses, like "root" or "cron" #14
Comments
What msmtp can do is this:
That should be enough to make all mail services accept the mail. Yes, I currently do consider rewriting the headers to arbitrary values to be outside the scope of msmtp, because I think the above is sufficient -- but that does not mean that I cannot change my mind if you can explain why it's not sufficient ;) External scripts can help, of course, but it's hard to prevent them from modifying the body of the mail instead of just the headers if a line in the mail body happens to start with |
I looked into |
Msmtp currently does not offer this flexibility and configurability. For your use case I would recommend using postfix. |
@marlam The combination of It's up to the Ansible role maintainer whether they support a wrapper like that or not. |
I'm reporting back that I've been testing the wrapper for about a year and it's been working fine. |
Some Linux utilities will send mail from a local address with no @ sign, like "cron" , to a local email address like "root" (again, no "@" sign or domain).
While
msmtp
has features to alter the envelope sender and recipient, it doesn't alter the "To:" or "From:" message itself.When the Envelope doesn't match these details, it can be considered spam. AWS SES is an example of an SMTP service that won't accept mail addressed to "root", even if the Envelope recipient is valid. But sending out cron mails is exactly the kind of thing that
msmtp
should be good for!One issue about this in the
msmtp
bug tracker is here:marlam/msmtp#98
So I propose that the Ansible role introduce a small feature to address, since the
msmtp
maintainer considers it out of scope.I successfully tested the solution of adding my own
sendmail
wrapper. In my case, I hard-coded an email address to use, but a proper solution could use a template variable and a variable for this:Then in Ansible:
I tested this with the
mail
app (mailx) on Ubuntu 22. It relies on clients looking up sendmail in $PATH. If some place has hardcoded the path to /usr/sbin/sendmail, my fix wouldn't cover that since I don't replace that file.The text was updated successfully, but these errors were encountered: