[CentOS] Setting From address for cronjob mails (because Gmail rejects)

Alexander Dalloz ad+lists at uni-x.org
Fri Jan 20 09:17:05 UTC 2012

Am 20.01.2012 09:57, schrieb Alexander Farber:
> Hello,
> thank you for your reply.
> I'd like to provide 2 quick additional details before trying your suggestions:
> 1) If I add a from address at the command line, then mail is delivered ok:
>       $ mail Alеxander.Farber at gmail.com -r wеbmaster at prеferans.de

That's because "mail -r" sets the envelope from address.

>    But if I just run
>       $ mail Аlеxander.Farber at gmail.com
>   then it is rejected by Gmail.

Very certainly because the envelope from is then localhost.localdomain.
Just check what "hostname" tells you. As you did not configure your MTA
the defaults are acting.

>   So I could append "| mail -r wеbmaster at preferans.de"
>   to all my cronjobs, but I'm looking for better solution

That is not advised.

You have a host in the public internet which sends emails. So take care
for everything involved and do not try to hack around your single
problem now. Your MTA needs a proper self-identification when sending out.

> 2) My ISP (hetzner.de) doesn't provide mail relaying at all.


I can see that your domain preferans.de resolves forward and reverse.
The MX is set to Google mail. Your smart host (as much as you would have
need for it) would be gmail. You have credentials, so you could do SMTP
AUTH. Though, as alexander.farber at gmail.com is the destination address,
Google mail has no need to relay to a further mail hop.

> Regards
> Alex


More information about the CentOS mailing list