PDA

View Full Version : Cgi Script... and sendmail


Paul
02-13-1999, 05:50 PM
Hi there...

I am testing out a cgi script and using sendmail...

Here is a snippet of the code:
-------------------------------------------------------------------------------------------------------------------

sub sendemail {
$TO=$_[0]; @TO=split('\0',$TO);
$SUBJECT=$_[1];
$REPLYTO=$_[2];
$REMOTE = $_[3];
$THEMESSAGE = $_[4];

open(S, "|$REMOTE -t");

print S "To: $TO[0]\n";
print S "From: <SMTPMAIL>\n";
print S "Subject: $SUBJECT\n";
print S "Reply-To: $REPLYTO\n\n";

# Print the body
print S "$THEMESSAGE\n";
print S "\n";
print S ".\n";
close (S);
}

-------------------------------------------------------------------------------------------------------------------

When I tested it out... here is the header from the email I got and wondered if someone could tell me how I would get it to reflect my email in the from and reply to
fields:

Subject:
Password
Date:
13 Feb 1999 18:15:24 -0000
From:
<SMTPMAIL@futurequest.net>
Reply-To:
nobody@futurequest.net
To:
paul@pumpkindriver.com


Any help would be greatly appreciated.

Terra
02-13-1999, 07:03 PM
2 problems

print S "From: <SMTPMAIL>\n";

This would be an 'unqualified' address, and the mail server would add the default domain of '@futurequest.net' to avoid problems with broken MTA's on the Internet... It is also hardcoded to '<SMTPMAIL>', not good... http://www.aota.net/ubb/frown.gif

change to:
print S "From: paul\@pumpkindriver.com\n";

The Reply-To: is a curious creature, as it's value is derived from the NULL '\0' delimited $TO variable, then split into the @TO array... You will have to trace back to the line that calls this subroutine and find out how it calls it... I would say there is a variable not set properly *before* the 'sendemail' subroutine is called...

Hope this helps...

--
Terra
--Heh, I'm not nobody, I'm a number--
FutureQuest

Paul
02-13-1999, 10:38 PM
Terra:

Thanks.. that fixes part of it anyway. http://www.aota.net/ubb/smile.gif
And....

it's value is derived from the NULL '\0' delimited $TO variable, then split into the@TO array.

Uh.. you are scaring the H. E. double hockey sticks outta me....


--------------------------------------
Paul

Jacob Stetser
02-14-1999, 12:47 AM
Uh.. you are scaring the H. E. double hockey sticks outta me....

LOL.. hee hee he heee.. hahahaha... ooohooo...

oh boy.. that was a good laugh. Terra, you have to admit that sentence of yours was pure g33ksp34k!

http://www.aota.net/ubb/smile.gif

Jake

Terra
02-14-1999, 01:07 AM
To know me, is to want to throw things at me... :Þ

--
Terra
--1 11k3 2 b ew33t, g33k5 n33d fw3nd5 2--
FutureQuest

Deb
02-14-1999, 01:38 AM
I couldn't agree with you more TeRRa http://www.aota.net/ubb/wink.gif

Deb
-1 11k3 t43 w4y u s4y rU1