I have a perl script that takes some information from a webpage and creates a formatted e mail.
I have tried everything to get it to work. It executes to the end ( since I correctly get a thank you page) but it does not send the mail to the address.
This is from the HTML form calling the script and setting the e mail address to be sent to:
<FORM METHOD=POST ACTION="/cgi-bin/import.pl">
<INPUT TYPE="hidden" NAME="email_to" value="someone@somewhere.com">
This is from the script import.pl
Here is where it calls the subroutine:
$to = $contents{'email_to'};
&mailto;
&thankyou;
This is the mailto subrouting
sub mailto {
#note I have also tried /usr/sbin/sendmail
open (MAIL, "|/usr/lib/sendmail -t"
|| die "can't open pipe to sendmail \n";
print MAIL "Content-Type: application/x-gm-impdata\n";
print MAIL "To: $to\n";
print MAIL "From: $csarry{'cs2_ContSupRef'}\n";
print MAIL "Subject: datafromgoldform.pl\n";
print MAIL "\n\n";
print MAIL "\[Instructions\]\n";
print MAIL "SaveThis=Web Import File\n";
print MAIL "DupCheck1=Contact\n";
print MAIL "\n";
print MAIL "OnNewSendEmail=Bart,NEW,Prospect requesting information \n";
print MAIL "OnDupSendEmail=Natalie,,Duplicate Record \n";
print MAIL "\n";
print MAIL "OnNewAttachTrack=WEB Lead\n";
print MAIL "\n";
# The following is an example of testing a field for a value
#print MAIL "Below a message will be printed if the CITY is Torrance\n\n";
if ($contents{CITY} eq "Torrance"
{
print MAIL "OnAnySendEmail=Jon,WCC,This one is from Torrance\n";
}
print MAIL "\n";
#print MAIL "Run=c:\goldmine\webimp.exe\n";
print MAIL "\n";
print MAIL "\n";
print MAIL "\[Data\]\n";
# print out general fields and values
foreach $name (sort keys %contents) {
next if $contents{$name} eq "";
print MAIL "$name = $contents{$name}\n";
}
print MAIL "\n";
print MAIL "\[ContSupp\]\n";
# print out profile/contsupp fields and values
foreach $name (sort keys %csarry) {
next if $csarry{$name} eq "";
print MAIL "$name = $csarry{$name}\n";
}
print MAIL "\n";
print MAIL "\n";
print MAIL "\n";
print MAIL "\n\n";
close (MAIL);
Any help would be greatly appreciated!
Thank You
Dave
I have tried everything to get it to work. It executes to the end ( since I correctly get a thank you page) but it does not send the mail to the address.
This is from the HTML form calling the script and setting the e mail address to be sent to:
<FORM METHOD=POST ACTION="/cgi-bin/import.pl">
<INPUT TYPE="hidden" NAME="email_to" value="someone@somewhere.com">
This is from the script import.pl
Here is where it calls the subroutine:
$to = $contents{'email_to'};
&mailto;
&thankyou;
This is the mailto subrouting
sub mailto {
#note I have also tried /usr/sbin/sendmail
open (MAIL, "|/usr/lib/sendmail -t"
print MAIL "Content-Type: application/x-gm-impdata\n";
print MAIL "To: $to\n";
print MAIL "From: $csarry{'cs2_ContSupRef'}\n";
print MAIL "Subject: datafromgoldform.pl\n";
print MAIL "\n\n";
print MAIL "\[Instructions\]\n";
print MAIL "SaveThis=Web Import File\n";
print MAIL "DupCheck1=Contact\n";
print MAIL "\n";
print MAIL "OnNewSendEmail=Bart,NEW,Prospect requesting information \n";
print MAIL "OnDupSendEmail=Natalie,,Duplicate Record \n";
print MAIL "\n";
print MAIL "OnNewAttachTrack=WEB Lead\n";
print MAIL "\n";
# The following is an example of testing a field for a value
#print MAIL "Below a message will be printed if the CITY is Torrance\n\n";
if ($contents{CITY} eq "Torrance"
print MAIL "OnAnySendEmail=Jon,WCC,This one is from Torrance\n";
}
print MAIL "\n";
#print MAIL "Run=c:\goldmine\webimp.exe\n";
print MAIL "\n";
print MAIL "\n";
print MAIL "\[Data\]\n";
# print out general fields and values
foreach $name (sort keys %contents) {
next if $contents{$name} eq "";
print MAIL "$name = $contents{$name}\n";
}
print MAIL "\n";
print MAIL "\[ContSupp\]\n";
# print out profile/contsupp fields and values
foreach $name (sort keys %csarry) {
next if $csarry{$name} eq "";
print MAIL "$name = $csarry{$name}\n";
}
print MAIL "\n";
print MAIL "\n";
print MAIL "\n";
print MAIL "\n\n";
close (MAIL);
Any help would be greatly appreciated!
Thank You
Dave