Re: Using Mail


Subject: Re: Using Mail
From: Arthur Corliss (acorliss@nevaeh-linux.org)
Date: Thu Feb 26 2004 - 15:18:39 AKST


On Thu, 26 Feb 2004, Jamie Hushower wrote:

>
> I am working in unfamiliar territory...
>
> Can anyone recommend an easy way to cause a message sent using the
> command line "mail" to appear to come from a sender other than the
> actual sender? I may not be asking the correct question.
>
> I have created a cgi script that sends confirmation email when an order
> is placed. Because the script is run by apache, the message appears to
> the recipient to be sent by "apache". This may be a bit confusing. Can I
> change the reply-to address? Does it necessarily have to be from a user
> with an account? I have been playing with sudo, but am not getting what
> I want. Or anything, for that matter.

Assuming the user is a trusted user you could use sendmail in arpanet mode and
have it extract the From:/Sender: fields from STDIN. The only downside is
that you do need to terminate lines with \r\n sequences (carriage return -
line feed).

For example, in Perl you would:

  open(MAIL, "| /usr/lib/sendmail -ba -t") || die $!;
  print MAIL "$headers\n\n$content";
  close(MAIL);

where $headers would be the To/From/Subject lines.

        --Arthur Corliss
          Bolverk's Lair -- http://arthur.corlissfamily.org/
          Digital Mages -- http://www.digitalmages.com/
          "Live Free or Die, the Only Way to Live" -- NH State Motto
---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.



This archive was generated by hypermail 2a23 : Thu Feb 26 2004 - 15:19:13 AKST