From: Martijn Lievaart on
On Mon, 08 Feb 2010 10:11:56 -0800, joe wrote:

> I tested this script with only 10 messages and it worked but I am not
> sure if it can handle a few thousands
>
> use Thread qw(:DEFAULT async yield);
>
> $thread = Thread->new(\&sendEmail($_,$in_sender,'',$in_subject,
> $in_letter));

Best to limit it to some number of threads so you don't overload your
machine. Wich probably destroys the effect your after.

Do you really need to send 1000 times one message? If the message doesn't
change, send it to many people at once.

If you do need to send individual messages, then it is going to take
time. You may want to investigate why sendmail is so slow.

As an alternative, write the messages to files and start a background
process that sends the messages.

M4
From: joe on
I think it has to be done individually. It is a email blast script for
our subscribers. I switched to net::smtp and I dont know if it will be
fast enough. If it is too slow I will try use a thread for every other
message.
From: Andrzej Adam Filip on
joe <jcharth(a)gmail.com> wrote:
> I think it has to be done individually. It is a email blast script for
> our subscribers. I switched to net::smtp and I dont know if it will be
> fast enough. If it is too slow I will try use a thread for every other
> message.

If your perl supports threads then redirect your question to
news:comp.mail.sendmail to get "hints" how to configure sendmail
for "sky is the limit" performance :-)

In short: how to reconfigure sendmail to allow your script control
number of sendmail processes attempting "at once" deliveries
[ one sendmail process per one "perl thread"/"smtp session" ].

--
[pl>en Andrew] Andrzej Adam Filip : anfi(a)onet.eu : Andrzej.Filip(a)gmail.com
"Why are we importing all these highbrow plays like `Amadeus'? I could
have told you Mozart was a jerk for nothing."
-- Ian Shoales
From: Jamie on
In <dddabba0-3fa9-4134-9ba0-44e53f32bc0f(a)m16g2000yqc.googlegroups.com>,
joe <jcharth(a)gmail.com> mentions:
>Hi I wrote a function that uses
>sendmail -oi -t -f
>to send emails. It is currently taking a long time to send many
>messages. Is there a way to speed this up?. Here is the code of the
>function

[snip]

You could optimize the code quite a bit, but I have a feeling it wouldn't
give you the performance you seek.

Your bottleneck is sendmail, even if you split the list up and ran a dozen
of them in parallel, it would only fill up sendmails que. (Giving it the
appearance that you've finished sending)


Jamie
--
http://www.geniegate.com Custom web programming
Perl * Java * UNIX User Management Solutions
From: Peter J. Holzer on
On 2010-02-11 18:47, Jamie <nospam(a)geniegate.com> wrote:
> In <dddabba0-3fa9-4134-9ba0-44e53f32bc0f(a)m16g2000yqc.googlegroups.com>,
> joe <jcharth(a)gmail.com> mentions:
>>Hi I wrote a function that uses
>>sendmail -oi -t -f
>>to send emails. It is currently taking a long time to send many
>>messages. Is there a way to speed this up?. Here is the code of the
>>function
>
> [snip]
>
> You could optimize the code quite a bit, but I have a feeling it wouldn't
> give you the performance you seek.
>
> Your bottleneck is sendmail, even if you split the list up and ran a dozen
> of them in parallel, it would only fill up sendmails que. (Giving it the
> appearance that you've finished sending)

Sendmail is quite capable of sending huge amounts of mail if you do it
right. However, configuring sendmail is off-topic in this group.

One simple trick (which is marginally on-topic, because it can be done
from the perl script, while configuring queues etc. is the postmaster's
job) which often makes a large difference is to set DeliveryMode=q or
even DeliveryMode=d. Then the sendmail command will just put all the
mails into the queue and leave delivery to the daemon. The daemon can
then figure out the best way to deliver them.

hp