Reputation: 593
I've been working on sending HTML emails using BSD mail and so far I've been successful. I've even been able to modify, not change though, the sender.
Current Command:
cat $htmlFile | mail -s "$(echo -e "$subject\nContent-Type: text/html")" $recipient -v -- -F $sender
However when the email comes through, the sender is only appending the $sender to the host name. Let's assume that the following is true
$user=root
$HOSTNAME=server.com
$sender='Application Support<[email protected]>'
When the email comes through it reads:
Application Support<[email protected]> <[email protected]>
How can I make it so that only the $sender variable is used in the email instead of appended?
OS: RHEL 5.10
Kernel Rev: 2.6.18-371.8.1.el5
Upvotes: 1
Views: 2135
Reputation: 3325
Still not sure what you're trying to do here, so I will take a stab and guess that you are looking for the -r
flag? It sets the 'from-addr'. I don't think it is present/supported in BSD mail, but it is in mailx
.
Other options include doing stuff with postfix/sendmail in order to set the sender address. You can do lots of stuff with aliases and the like, and more advanced mangling can be done through "transports" if you write your own handler.
Upvotes: 2