[PLUG] Sendmail w/ PERL
Ryan E. Helfter
reh@blacksoul.net
Mon, 2 Oct 2000 08:20:54 -0500 (EST)
(if you happen to be running the script as root or a trusted user, this is
an alternative...) do a man sendmail for the -f option
try this as your open statement:
open (MESSAGE, "|/usr/lib/sendmail -f sender\@someone.com
someone\@somewhere.com") || die "Could not open sendmail";
instead of this:
open (MAIL,"|/usr/lib/sendmail -t") || die "Could not open sendmail, $!";
ry
On Mon, 2 Oct 2000, Matt wrote:
> Date: Mon, 02 Oct 2000 07:30:13 -0500
> From: Matt <wirges@expert.cc.purdue.edu>
> To: plug@csociety.purdue.edu
> Subject: [PLUG] Sendmail w/ PERL
>
Okay so I have a formmail script that creates a message like this:
>
> open (MAIL,"|/usr/lib/sendmail -t") || die "Could not open sendmail,
> $!";
> print MAIL "To: $email\n";
> print MAIL "From: $from\n";
> print MAIL "Subject: $subj\n\n";
> print MAIL "$body\n";
> close (MAIL) || die "Could not close sendmail, $!";
>
> That works fine, I will get an email that says:
> > To: someone@somewhere.com
> > From: sender@somewhere.com
> > Subject: Test Mail
> >
> > This is a test this is only a test.
> >
> however when I use that same code in a mail program from the command
> line
> sendmail doesn't seem to be able to extract the <B>From:</B> and the
> <B>Subject:</B> lines from it.
> I get an email that looks like this:
> > To: someone@somewhere.com
> > From: root@archimedes.swi.dyndns.org (sendmail missed the from: field and supplied the default)
> >
> > Subject: This is a test (This is the message body, the string "Subject: This is a
> > This is a test this is only a test. (test." Was put in the body and not the header.);
> >
> I of course checked to make sure the vars got passed correctly to
> sendmail and they did, Any one got any ideas?
>
--
Ryan E. Helfter
reh@blacksoul.net
Black Soul Networks, LLC
--