|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
||||
|
||||
|
Hi,
I`m installing the MLM from www.webscriptworld.com however it just doesn`t want to send emails, it comes up as saying the mail is sent but it never comes through, can anyone see any possible problems in the following code? #!/usr/local/bin/perl read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; if ($INPUT{$name}) { $INPUT{$name} = $INPUT{$name}.",".$value; } else { $INPUT{$name} = $value; } } $pid = fork(); print "Content-type: text/html \n\n fork failed: $!" unless defined $pid; if (!$pid) { print "Content-type: text/html \n\n"; print "<html><head><title>List Administration</title></head><body> <br><br><br><center> <table width=280><tr><td width=280 valign=top> <table width=\"280\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\" bordercolor=\"#808080\" bordercolorlight=\"black\" bordercolordark=\"white\"> <tr><td bgcolor=\"#0000A0\"> <font face=\"arial\" size=\"2\" color=\"white\"><b>Send Status</b> </td></tr><tr><td bgcolor=\"#C0C0C0\"><font face=\"arial\" size=\"2\"> <br><center>Success!<BR>The message was sent. <P><FORM><INPUT TYPE=BUTTON VALUE=\"Return to MLM\" onClick=\"history.go(-1)\"></form> </td></tr></table></td></tr></table> </center></body></html>"; exit(0); } else { close (STDOUT); open(LIST,"$INPUT{'address_file'}"); @addresses=<LIST>; close(LIST); foreach $line(@addresses) { chomp($line); open(MAIL, "|$INPUT{'mail_prog'} -t") || &error("Could not send out emails"); print MAIL "To: $line \n"; print MAIL "From: $INPUT{'listname'} <$INPUT{'from'}>\n"; print MAIL "Subject: $INPUT{'subject'}\n"; if ($INPUT{'html'}) { print MAIL "MIME-Version: 1.0\n"; print MAIL "Content-Type: text/html;\n"; print MAIL "Content-Transfer-Encoding: 7bit\n\n"; } print MAIL "$INPUT{'body'}"; print MAIL "\n\n"; if ($INPUT{'unsubchk'}) { print MAIL "===========================================================\n"; print MAIL "You have received this email because you subscribed to the $INPUT{'listname'} Mailing Service. To unsubscribe simply visit the link below.\n"; print MAIL "$INPUT{'url'}/unsub.php?list=$INPUT{'list'}&email=$line\n"; } print MAIL "\n\n"; close (MAIL); } } I have checked the sendmail path, I have chmod`d the file to 755 I have asked around on the support forum for the script yet everyone is having the same problem. Thanks for reading Ade |
|
#2
|
||||
|
||||
|
The problem appears to be in this line:
if (!$pid) { where it should be if ($pid) { . Mickalo
__________________
Thunder Rain Internet Publishing Custom Programming & Database development Providing Personal/Business Internet Solutions that work! |
|
#3
|
||||
|
||||
|
Oh I see,
Well the script original comes as ($pid) but even that doesn`t send the emails so thats when I originally went to the forum at webscriptworld.com to get help and they say to stick in the ! although as you can see it doesn`t work either. Ade |
|
#4
|
||||
|
||||
|
What type of server, OS, are you using this on? Are you getting an errors?
Mickalo |
|
#5
|
||||
|
||||
|
Hi,
No no errors are coming through at all, iot basically says the email has been sent to the list. The Server info can be seen here http://64.70.201.117/mlm/phpinfo.php I`m pretty sure it`s a Linux Ade |
|
#6
|
||||
|
||||
|
Well if the server supports the fork() function, which most do, and the path to "sendmail" is correct, I'm assuming it's using "sendmail". Then the only other possible problem maybe the address file. In the code that opens the file, try adding a die after it to make it is opening and reading the file:
Code:
open(LIST,"$INPUT{'address_file'}") or die ("can't open $INPUT{'address_file'} file $!") ;
@addresses=<LIST>;
close(LIST);
Mickalo |
|
#7
|
||||
|
||||
|
Mickalo,
Thanks for the help, it was the path to the address_file which was wrong so when I added your code it picked up on it. All fixed and working now, thank you. Ade |
|
#8
|
||||
|
||||
|
Glad to help
![]() Mickalo |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Perl Programming > Can anyone see a problem with this code? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|