Mac Newbold wrote:
Today at 7:51pm, Andrew Jorgensen said:
I need a way to set the 'From' address in a email sent from the
command-line using the 'mail' program (the BSD version I think, whatever
Red Hat / Fedora is using).  I imagine that this program uses the local
mail service (postfix in this case), so a configuration there would be fine.


Depending on the version of 'mail' you have, you can do it in several
ways. Sometimes the "From:" header can just be passed in on stdin with the
rest of the headers and the message by using the -t switch, IIRC. Some
versions also have a -f flag that lets you pass a from address through to
sendmail.

My version has none of the options you mention, but it looks like you can pass options on to the sendmail program by ending your commandline with a - and the the sendmail options. I tried


mail [EMAIL PROTECTED] - -f [EMAIL PROTECTED]

but it complains at me thusly "Cannot give -f and people to send to." (Why not!?!)

So I tried just using sendmail (the postfix version of that program anyway) like so

/usr/sbin/sendmail [EMAIL PROTECTED] -f [EMAIL PROTECTED]

But this gives an oh so helpful header that says

To: undisclosed-recipients:;

Which is less than desirable, but it looks to me like that's the way sendmail does it.

____________________
BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to