Objective
I'm trying to configure a CentOS 7 system so all mail sent to local system accounts gets redirected to an alternate email address. For example, if mail is sent to root
I want it to be redirected to [email protected]
.
I have a mostly working configuration using postfix, generic maps, and aliases. If the complete configuration I'm using will help, ask and I'll modify the question to include it.
If there's a better way of accomplishing my objective, please tell me. I'd prefer to stick with postfix, but only because it's the default MTA on CentOS.
Problem
I'm trying to configure postfix as a smart host so I can relay mail via a ZOHO account. However, ZOHO is extremely picky about the format of the from address.
When I try to send mail with a sender address that looks like this, it works:
[email protected]
However, when I try to send mail with a sender address that looks like this, it fails:
[email protected] (Ryan)
Examples
Below are 4 examples sent using the exact same postfix configuration.
Allowed
I use this command:
mail -r "[email protected]" -s "Testing." root <<< "Test to root."
...and see this in maillog
(I've stripped the message down and reformatted it to make it a bit more readable):
CD9FA29D20: from=<[email protected]>
CD9FA29D20: to=<[email protected]>,
orig_to=<root>,
relay=smtp.zoho.com[74.201.154.90]:587,
delay=2.4,
delays=0/0.02/1.7/0.66, dsn=2.0.0,
status=sent (250 Message received)
Allowed
I use this command:
mail -r "Ryan <[email protected]>" -s "Testing." root <<< "Test to root."
...and see this in maillog
(I've stripped the message down and reformatted it to make it a bit more readable):
936C929D20: from=<[email protected]>
936C929D20: to=<[email protected]>,
orig_to=<root>,
relay=smtp.zoho.com[74.201.154.90]:587,
delay=2.3,
delays=0/0.03/1.6/0.7,
dsn=2.0.0,
status=sent (250 Message received)
Relaying Denied
I use this command:
mail -r "[email protected] (Ryan)" -s "Testing." root <<< "Test to root."
...and see this in maillog
(I've stripped the message down and reformatted it to make it a bit more readable):
D57C529D20: from=<[email protected]>
D57C529D20: to=<[email protected]>,
orig_to=<root>,
relay=smtp.zoho.com[74.201.154.90]:587,
delay=2,
delays=0.01/0/1.4/0.64,
dsn=5.0.0,
status=bounced (host smtp.zoho.com[74.201.154.90] said:
553 Relaying disallowed as [email protected] (Ryan) (in reply to end of DATA command))
Relaying Denied
I use this command:
mail -s "Testing." root <<< "Test to root."
...and see this in maillog
(I've stripped the message down and reformatted it to make it a bit more readable):
9CFE629D20: from=<[email protected]>
9CFE629D20: to=<[email protected]>,
orig_to=<root>,
relay=smtp.zoho.com[74.201.154.90]:587,
delay=2,
delays=0/0.02/1.4/0.6,
dsn=5.0.0,
status=bounced (host smtp.zoho.com[74.201.154.90] said:
553 Relaying disallowed as [email protected] (Ryan) (in reply to end of DATA command))
Question
It's the last example that I'm having trouble with since the default when not explicitly including the address is to write the address in a way that ZOHO will reject.
Is it possible to have postfix strip or rewrite a person's name when rewriting a sender address? There's a similar question to here, but it doesn't accomplish what I want. I don't want to rely on changing user account settings to ensure my mail doesn't get bounced.
Ryan <[email protected]>
.mail
will cause it to be written the way that ZOHO rejects. Maybe there's somemail
configuration that I've missed.~/.mailrc
and environment variables.