[KLUG Members] using mail to set From address

Adam Williams members@kalamazoolinux.org
Fri, 16 Jan 2004 15:14:03 -0500


> Using the mail command in a script works fine for sending mail except 
> when the ISP requires a legitimate sender.  That is, if the "From" 
> header is "user@localhost.localdomain," some ISPs block it.
> What is the best way to get around that?  Can the mail command be used 
> to set the From header?  Is there another setting outside mail that can 
> be changed?  Can another program be used from within a BASH script to 
> send email?

"mail" is passing it off to the MTA (most likely sendmail).  So you just
need to set the masquerade address and sendmail will rewrite the header
accordingly.