Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Iron Speed
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old February 27th, 2001, 12:55 AM
SilkySmooth's Avatar
SilkySmooth SilkySmooth is offline
Newbie :P
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2001
Location: In the PHP Engine :-)
Posts: 2,880 SilkySmooth User rank is Sergeant (500 - 2000 Reputation Level)SilkySmooth User rank is Sergeant (500 - 2000 Reputation Level)SilkySmooth User rank is Sergeant (500 - 2000 Reputation Level)SilkySmooth User rank is Sergeant (500 - 2000 Reputation Level)SilkySmooth User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 11 h 32 m 23 sec
Reputation Power: 15
Question

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

Reply With Quote
  #2  
Old February 27th, 2001, 09:23 AM
mickalo's Avatar
mickalo mickalo is offline
Ole` Timer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: N.W. Iowa
Posts: 469 mickalo User rank is Private First Class (20 - 50 Reputation Level)mickalo User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 5 h 19 sec
Reputation Power: 8
Send a message via AIM to mickalo Send a message via MSN to mickalo
Thumbs up

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!

Reply With Quote
  #3  
Old February 27th, 2001, 10:11 AM
SilkySmooth's Avatar
SilkySmooth SilkySmooth is offline
Newbie :P
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2001
Location: In the PHP Engine :-)
Posts: 2,880 SilkySmooth User rank is Sergeant (500 - 2000 Reputation Level)SilkySmooth User rank is Sergeant (500 - 2000 Reputation Level)SilkySmooth User rank is Sergeant (500 - 2000 Reputation Level)SilkySmooth User rank is Sergeant (500 - 2000 Reputation Level)SilkySmooth User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 11 h 32 m 23 sec
Reputation Power: 15
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

Reply With Quote
  #4  
Old February 27th, 2001, 10:19 AM
mickalo's Avatar
mickalo mickalo is offline
Ole` Timer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: N.W. Iowa
Posts: 469 mickalo User rank is Private First Class (20 - 50 Reputation Level)mickalo User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 5 h 19 sec
Reputation Power: 8
Send a message via AIM to mickalo Send a message via MSN to mickalo
Thumbs up

What type of server, OS, are you using this on? Are you getting an errors?

Mickalo

Reply With Quote
  #5  
Old February 27th, 2001, 10:27 AM
SilkySmooth's Avatar
SilkySmooth SilkySmooth is offline
Newbie :P
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2001
Location: In the PHP Engine :-)
Posts: 2,880 SilkySmooth User rank is Sergeant (500 - 2000 Reputation Level)SilkySmooth User rank is Sergeant (500 - 2000 Reputation Level)SilkySmooth User rank is Sergeant (500 - 2000 Reputation Level)SilkySmooth User rank is Sergeant (500 - 2000 Reputation Level)SilkySmooth User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 11 h 32 m 23 sec
Reputation Power: 15
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

Reply With Quote
  #6  
Old February 27th, 2001, 10:35 AM
mickalo's Avatar
mickalo mickalo is offline
Ole` Timer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: N.W. Iowa
Posts: 469 mickalo User rank is Private First Class (20 - 50 Reputation Level)mickalo User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 5 h 19 sec
Reputation Power: 8
Send a message via AIM to mickalo Send a message via MSN to mickalo
Thumbs up

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

Reply With Quote
  #7  
Old February 27th, 2001, 11:35 AM
SilkySmooth's Avatar
SilkySmooth SilkySmooth is offline
Newbie :P
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2001
Location: In the PHP Engine :-)
Posts: 2,880 SilkySmooth User rank is Sergeant (500 - 2000 Reputation Level)SilkySmooth User rank is Sergeant (500 - 2000 Reputation Level)SilkySmooth User rank is Sergeant (500 - 2000 Reputation Level)SilkySmooth User rank is Sergeant (500 - 2000 Reputation Level)SilkySmooth User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 11 h 32 m 23 sec
Reputation Power: 15
Thumbs up

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

Reply With Quote
  #8  
Old February 27th, 2001, 11:39 AM
mickalo's Avatar
mickalo mickalo is offline
Ole` Timer
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2000
Location: N.W. Iowa
Posts: 469 mickalo User rank is Private First Class (20 - 50 Reputation Level)mickalo User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 5 h 19 sec
Reputation Power: 8
Send a message via AIM to mickalo Send a message via MSN to mickalo
Thumbs up KWEL!

Glad to help

Mickalo

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Can anyone see a problem with this code?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

IBM developerWorks




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway