I worked this out yesterday and thought others might find it useful. I needed to be able to send email via a shell script where the script was operating on behalf of any number of users on the system. The script was running under a login different from that of the individuals using it.
As a consequence all email sent using 'mail' or 'Mail' was seen as coming from the user under which the script ran, the individual users had no proof that the mail ever got sent, and the recipients were confused as to who the mail was really from. Here's the no-code solution to the dilemna, use mutt like this: Mutt allows you to define an EMAIL environment variable to specify the From: address. If you define it as just a user like [EMAIL PROTECTED] then it will format the from address (asuming the account running the script is called 'sharedapp') like this: From: sharedapp <[EMAIL PROTECTED]> Well, this is probably not what you want. But if you do this: EMAIL="Foo Bar <[EMAIL PROTECTED]>" Then the from address will be a thing of beauty like this: From: Foo Bar <[EMAIL PROTECTED]> So that established the sender stuff. Now how about the other pieces? Well we can tell mutt to send a CC to whoever we like. The subject can also be specified on the command line, and it nicely reads from STDIN or from a file. So commands like this are useful: cat mymessage | mutt -c [EMAIL PROTECTED] -s "This is a test message" \ [EMAIL PROTECTED] mutt -c [EMAIL PROTECTED] -s "This is a test message" [EMAIL PROTECTED] < mymessage Or you can use the -f switch on mutt to specify a file instead of using input redirection. Hope others find this useful too! -- Dan Coutu Managing Director Snowy Owl Internet Consulting, LLC http://www.snowy-owl.com/ _______________________________________________ gnhlug-discuss mailing list [EMAIL PROTECTED] http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss