Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP Perl Script Won't sendmail

Status
Not open for further replies.

BigDave77

MIS
Apr 4, 2001
7
US
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=&quot;/cgi-bin/import.pl&quot;>
<INPUT TYPE=&quot;hidden&quot; NAME=&quot;email_to&quot; value=&quot;someone@somewhere.com&quot;>

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, &quot;|/usr/lib/sendmail -t&quot;) || die &quot;can't open pipe to sendmail \n&quot;;
print MAIL &quot;Content-Type: application/x-gm-impdata\n&quot;;
print MAIL &quot;To: $to\n&quot;;
print MAIL &quot;From: $csarry{'cs2_ContSupRef'}\n&quot;;
print MAIL &quot;Subject: datafromgoldform.pl\n&quot;;
print MAIL &quot;\n\n&quot;;
print MAIL &quot;\[Instructions\]\n&quot;;
print MAIL &quot;SaveThis=Web Import File\n&quot;;
print MAIL &quot;DupCheck1=Contact\n&quot;;
print MAIL &quot;\n&quot;;
print MAIL &quot;OnNewSendEmail=Bart,NEW,Prospect requesting information \n&quot;;
print MAIL &quot;OnDupSendEmail=Natalie,,Duplicate Record \n&quot;;
print MAIL &quot;\n&quot;;
print MAIL &quot;OnNewAttachTrack=WEB Lead\n&quot;;
print MAIL &quot;\n&quot;;
# The following is an example of testing a field for a value
#print MAIL &quot;Below a message will be printed if the CITY is Torrance\n\n&quot;;
if ($contents{CITY} eq &quot;Torrance&quot;) {
print MAIL &quot;OnAnySendEmail=Jon,WCC,This one is from Torrance\n&quot;;
}
print MAIL &quot;\n&quot;;
#print MAIL &quot;Run=c:\goldmine\webimp.exe\n&quot;;
print MAIL &quot;\n&quot;;
print MAIL &quot;\n&quot;;
print MAIL &quot;\[Data\]\n&quot;;
# print out general fields and values
foreach $name (sort keys %contents) {
next if $contents{$name} eq &quot;&quot;;
print MAIL &quot;$name = $contents{$name}\n&quot;;
}
print MAIL &quot;\n&quot;;
print MAIL &quot;\[ContSupp\]\n&quot;;

# print out profile/contsupp fields and values
foreach $name (sort keys %csarry) {
next if $csarry{$name} eq &quot;&quot;;
print MAIL &quot;$name = $csarry{$name}\n&quot;;
}
print MAIL &quot;\n&quot;;
print MAIL &quot;\n&quot;;

print MAIL &quot;\n&quot;;
print MAIL &quot;\n\n&quot;;
close (MAIL);

Any help would be greatly appreciated!

Thank You
Dave
 
Dave,

Could I suggest you cut your script down to the minimum possible when you're testing a new technique?

Get it to send a plain email with just a subject line and a one line body.

There's also a, very good, tek-tips FAQ at faq219-364 Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top