how to change from address using shell mail command?

Hi

I am trying to do what I thought would be a very simple thing and that is send mail using the mail command but not have it come from user@server.hostname but able to set the from address. The reason is nagios emails.

Seems the tricks I have found do not work on the freebsd mail binary.

my mail smtp daemon is exim.

exim itself supports -f sender but it doesnt allow me to set the subject on the command line, so I need to be able to specify the subject and from address on the command, thanks.
 
ok I found a site which gives examples and I seem to have it working now, worked from mail on shell :)
 
Sure.

In exim.conf add a rewrite section like this.
Code:
begin rewrite

nagios@originaldomain.com "Nagios psuedo-user <nagios@domainyouwant.com>" Ffrsbc
Also the user who is sending the email, in my case the nagios user has to be a trusted user in the exim config.
 
Back
Top