Forum Moderators: coopster & phranque

Message Too Old, No Replies

help. My emailer apparently didn't work

mass email Perl SMTP

         

rfrick

11:39 pm on May 20, 2005 (gmt 0)

10+ Year Member



I tested the following for 4 addresses, and it worked fine. But then when it was tried for 500 addresses, it bombed part way through. Data: my email address is at the start and end of the list, and I got only one email.

I don't know how to even start debugging. The error message was lost.

foreach $addr (@addresses) {
$smtp = Net::SMTP->new($host) ¦¦ print "couldn't do the new command<BR>\n";
$smtp->mail('$address') ¦¦ print "couldn't tell it the sender<BR>\n";

$smtp->to($addr) ¦¦ print "couldn't tell it the recipient ($addr)<BR>\n";

$smtp->data() ¦¦ $smtp->data() ¦¦ print "There was a problem starting for $addr<BR>\n";

$smtp->datasend("Reply-to: $replyto\n") ¦¦ $smtp->datasend("Reply-to: $replyto\n") ¦¦ print "There was a problem sending replyto for $addr<BR>\n";

$smtp->datasend("Subject: $subject\n\n") ¦¦ $smtp->datasend("Subject: $subject\n\n") ¦¦ print "There was a problem sending subject for $addr<BR>\n";
$smtp->datasend("$message\n\n") ¦¦ $smtp->datasend("$message\n") ¦¦ print "There was a problem sending message for $addr<BR>\n";
$smtp->datasend("$trailer\n\n") ¦¦ $smtp->datasend("$trailer\n\n") ¦¦ print "There was a problem sending trailer for $addr<BR>\n";
$smtp->dataend() ¦¦ $smtp->dataend() ¦¦ print "There was a problem ending for $addr<BR>\n";
$smtp->quit;
}

I tried doing it by listing multiple recipients, but that didn't work. That's why it's all in a loop. Inelegant I know, but like I said, it worked for 4 addresses.

Any suggestions? This is my first attempt at a mass mailing.

Bob the desperate

moltar

12:09 am on May 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are running the script on your local computer or the hosting server? If it's the hosting, then they might have some restrictions on the amount of outgoing mail per second/minute/hour.

I see you have plenty of debugging messages. At what point exactly does it stop sending?

rfrick

12:59 am on May 21, 2005 (gmt 0)

10+ Year Member



Thanks Moltar. You were exactly right, there is a limit on how fast emails can go out. I have found the problem and I am a happy camper.

Bob

rfrick

8:41 pm on May 23, 2005 (gmt 0)

10+ Year Member



I am not a happy camper.

My client sent out her email. My Perl program ran for 5 hours, mostly sleeping, sending out one email every 40 seconds, to avoid sending too often. It writes to a file when there is a problem. There was only one problem. It writes to another file when it is done sending emails. It got to the end of the list. Great.

But my email address is at the end of the list, and I didn't get an email.

Am I supposed to reset if something goes wrong? That's the only thing I can think of.

Part of my problem is that the program usually runs fine when I tested; at least, I do not recall this problem. I can't have my client testing it on her 500 email addresses (more often than she already has).

My code, in case that helps, a little cleaned up. It runs through this for every person. The reported failures were for one person on $smtp->to and $smtp->data()

$smtp = Net::SMTP->new($host);
$smtp->mail('@emailaddress') ¦¦ print DATA2 "sender; $addr<BR>\n";
$smtp->to($addr) ¦¦ print DATA2 "recipient($addr)<BR>\n";

$smtp->data() ¦¦ print DATA2 "starting for $addr<BR>\n";

$smtp->datasend("Reply-to: $replyto\n") ¦¦ print DATA2 "sending replyto for $addr<BR>\n";

$smtp->datasend("Subject: $subject\n\n") ¦¦ print DATA2 "There was a problem sending subject for $addr<BR>\n";
$smtp->datasend("$message\n\n") ¦¦ print DATA2 "There was a problem sending message for $addr<BR>\n";

$smtp->dataend() ¦¦ print DATA2 "There was a problem ending for $addr<BR>\n";
$smtp->quit;

Bob