Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Problematic delay in script

Reply
Thread Tools

Problematic delay in script

 
 
\Dandy\ Randy
Guest
Posts: n/a
 
      09-17-2003
Hello, I have created a mailing program for our company that sends out
emails to our client database. There seems to be a delay in the script or
the processing of the emails. Here is how it works. The email addresses are
stored in a simple text file, one on top of each other. Each email is sent
through a foreach loop. I use this code to get email addresses and send the
emails:

open (ADDRESSES, "<address.txt") or die "Can't open file: $!";
@list=<ADDRESSES>;
close(ADDRESSES);

$mailprog="/usr/sbin/sendmail -t";

foreach $list (@list) {
chomp ($list);
($name,$email)=split(/\|/,$list);

open (MAIL, "|$mailprog") or die "Can't open main program: $!";
print MAIL "From: $adminname <$adminemail>\n";
print MAIL "To: $fullname <$email>\n";
print MAIL "Subject: $subject\n";
print MAIL "MIME-Version: 1.0\n";
print MAIL "X-MSMail-Priority: $priority\n";
print MAIL "Content-Type: multipart/alternative;\n";
print MAIL " boundary=\"separator\"\n\n";
print MAIL "This is a multi-part message in MIME format.\n\n";
print MAIL "--separator\n";
print MAIL "Content-Type: text/plain;\n";
print MAIL " charset=\"iso-8859-1\"\n\n";
print MAIL "@textonly\n\n";
print MAIL "--separator\n";
print MAIL "Content-Type: text/html;\n";
print MAIL " charset=\"iso-8859-1\"\n\n";
print MAIL "@content\n\n";
print MAIL "--separator--";
close (MAIL);
}

print "Confirmation Message";

For testing purposes, the address.txt file contains 100 email addresses ...
all different, but in the end end up in my inbox ... so if I recieve 100
emails the script works. Well it does ... I do get the 100 emails but heres
the thing ... almost right away I get about 60-70 emails ... but then the
other 30 seem to get delivered at random intervals. Some take 5 minutes,
some take 5 hours. I am puzzled why so many take so long to get delivered?
Am I overloading sendmail? or maybe my email account? Your
thoughts/reccommendations are appriciated.

Randy


 
Reply With Quote
 
 
 
 
Tad McClellan
Guest
Posts: n/a
 
      09-17-2003
\"Dandy\" Randy <(E-Mail Removed)> wrote:

> Hello, I have created a mailing program for our company that sends out
> emails to our client database.


> Your
> thoughts/reccommendations are appriciated.



use Mail::Bulkmail;


--
Tad McClellan SGML consulting
http://www.velocityreviews.com/forums/(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
 
 
 
Beau Schwabe
Guest
Posts: n/a
 
      09-17-2003
Just for test... try halving your database....i.e. send two chunks of
50 emails. Does the first 50 go through ok? The second? or does it
stop at 20 or so and spit the remainder 30 out at intermittent
intervals?

-Beau Schwabe

>Hello, I have created a mailing program for our company that sends out
>emails to our client database. There seems to be a delay in the script or
>the processing of the emails. Here is how it works. The email addresses are
>stored in a simple text file, one on top of each other. Each email is sent
>through a foreach loop. I use this code to get email addresses and send the
>emails:
>
>open (ADDRESSES, "<address.txt") or die "Can't open file: $!";
> @list=<ADDRESSES>;
>close(ADDRESSES);
>
>$mailprog="/usr/sbin/sendmail -t";
>
>foreach $list (@list) {
>chomp ($list);
>($name,$email)=split(/\|/,$list);
>
>open (MAIL, "|$mailprog") or die "Can't open main program: $!";
>print MAIL "From: $adminname <$adminemail>\n";
>print MAIL "To: $fullname <$email>\n";
>print MAIL "Subject: $subject\n";
>print MAIL "MIME-Version: 1.0\n";
>print MAIL "X-MSMail-Priority: $priority\n";
>print MAIL "Content-Type: multipart/alternative;\n";
>print MAIL " boundary=\"separator\"\n\n";
>print MAIL "This is a multi-part message in MIME format.\n\n";
>print MAIL "--separator\n";
>print MAIL "Content-Type: text/plain;\n";
>print MAIL " charset=\"iso-8859-1\"\n\n";
>print MAIL "@textonly\n\n";
>print MAIL "--separator\n";
>print MAIL "Content-Type: text/html;\n";
>print MAIL " charset=\"iso-8859-1\"\n\n";
>print MAIL "@content\n\n";
>print MAIL "--separator--";
>close (MAIL);
>}
>
>print "Confirmation Message";
>
>For testing purposes, the address.txt file contains 100 email addresses ...
>all different, but in the end end up in my inbox ... so if I recieve 100
>emails the script works. Well it does ... I do get the 100 emails but heres
>the thing ... almost right away I get about 60-70 emails ... but then the
>other 30 seem to get delivered at random intervals. Some take 5 minutes,
>some take 5 hours. I am puzzled why so many take so long to get delivered?
>Am I overloading sendmail? or maybe my email account? Your
>thoughts/reccommendations are appriciated.
>
>Randy
>
>


 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      09-17-2003
\"Dandy\" Randy <(E-Mail Removed)> wrote:

> print MAIL "@content\n\n";



That adds space characters to the body of the email message.

Is that what you want it to do?



perldoc -q spaces

Why do I get weird spaces when I print an array of lines?


--
Tad McClellan SGML consulting
(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
\Dandy\ Randy
Guest
Posts: n/a
 
      09-17-2003
Yes, this \n\n is required at the end of the html body content, otherwise
the multipart html will send process the separators correctly.

"Tad McClellan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> \"Dandy\" Randy <(E-Mail Removed)> wrote:
>
> > print MAIL "@content\n\n";

>
>
> That adds space characters to the body of the email message.
>
> Is that what you want it to do?
>
>
>
> perldoc -q spaces
>
> Why do I get weird spaces when I print an array of lines?
>
>
> --
> Tad McClellan SGML consulting
> (E-Mail Removed) Perl programming
> Fort Worth, Texas



 
Reply With Quote
 
\Dandy\ Randy
Guest
Posts: n/a
 
      09-17-2003
> use Mail::Bulkmail;

I do not believe my hosting company had this module installed.

R


 
Reply With Quote
 
David K. Wall
Guest
Posts: n/a
 
      09-17-2003
[TOFU rearranged to proper chronological order. Please don't do
that.]

"Dandy" Randy <(E-Mail Removed)> wrote:

>
> "Tad McClellan" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> \"Dandy\" Randy <(E-Mail Removed)> wrote:
>>
>> > print MAIL "@content\n\n";

>>
>>
>> That adds space characters to the body of the email message.
>>
>> Is that what you want it to do?
>>
>>
>> perldoc -q spaces
>>
>> Why do I get weird spaces when I print an array of lines?


> Yes, this \n\n is required at the end of the html body content,
> otherwise the multipart html will send process the separators
> correctly.


The "\n\n" is not what Tad was talking about. If you read the FAQ
entry he referred to you'll see what Tad was asking.

--
David Wall
 
Reply With Quote
 
\Dandy\ Randy
Guest
Posts: n/a
 
      09-17-2003
"Beau Schwabe" <(E-Mail Removed)> wrote
news:(E-Mail Removed)...
> Just for test... try halving your database....i.e. send two chunks of
> 50 emails. Does the first 50 go through ok? The second? or does it
> stop at 20 or so and spit the remainder 30 out at intermittent
> intervals?


Beau, I did a test a you suggested ...

Test #1
Sent: 50 emails all to my inbox
Result: All 50 delivered timely ... within 30 seconds

--- Waiting 2 minutes before next test

Test #2
Sent: 50 emails all to my inbox (again, same addresses)
Result: 49 delivered timely ... within 30 seconds. 1 email has not arrived.
most likely will at some point

--- Waiting 2 minutes before next test

Test #3
Sent: 100 emails all to my inbox (same addresses)
Result: 85 delivered timely ... within 30 seconds. 15 emails have not
arrived.


 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      09-17-2003
\"Dandy\" Randy <(E-Mail Removed)> wrote:
>> use Mail::Bulkmail;

>
> I do not believe my hosting company had this module installed.



Then install it yourself.


--
Tad McClellan SGML consulting
(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
\Dandy\ Randy
Guest
Posts: n/a
 
      09-17-2003
> > I do not believe my hosting company had this module installed.
>
>
> Then install it yourself.


???


 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculating propagation delay & transmission delay Stone Cisco 1 09-27-2006 06:26 PM
HELP? Composer Problematic Mozilla/Nvu/Netscape glob Firefox 1 12-29-2004 05:51 PM
placeholder proves problematic postback Fraggle ASP .Net 1 11-27-2003 12:13 PM
Problematic Postbacks Duray AKAR ASP .Net 0 08-12-2003 07:08 PM
Re: Problematic Postbacks Lim Siew Cheng ASP .Net 3 08-12-2003 06:23 PM



Advertisments