Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Bulk Email Load balancing

by diggernz (Sexton)
on Mar 08, 2006 at 00:30 UTC ( #535063=perlquestion: print w/replies, xml ) Need Help??

diggernz has asked for the wisdom of the Perl Monks concerning the following question:

I have written a program to handle bulk mail outs to a client database. There could be upto 1000 emails sent out at a given email campaign. Clients HAVE subscribed to this service. What technique can I use to reduce network activity. When this program is run, the network becomes exhausted. I have added a loop to pause after a given number of mailouts. This isn't solving the problem. Is there any other techniques you suggest? Thank you

Replies are listed 'Best First'.
Re: Bulk Email Load balancing
by tirwhan (Abbot) on Mar 08, 2006 at 07:00 UTC

    Take a look at Mail::BulkMail, that'll combine messages going to different local parts at the same domain into one send and thus significantly cut down on the number of deliveries that need to be made. Also, consider installing a caching DNS server to reduce the number of external DNS requests that need to be made.

    All dogma is stupid.
Re: Bulk Email Load balancing
by TedPride (Priest) on Mar 08, 2006 at 01:00 UTC
    Am I correct that the problem is the number of copies of the same email stacking up on the mail server, waiting to be sent? Obviously, slowing the rate you send emails at won't fix this, unless none of them have problems and the mail server sends faster than it receives. What you need is an intermediary utility that collects all emails and queues them only as fast as the mail server can handle sends. Perhaps you can add each email body to a database table along with the set of addresses it needs to go to (many to one relationship in second table?), then have an intermediary utility perform all the sends at some rate determined by how much the mail server can handle. This way you don't have the mail server clogged with thousands of copies of the same email while you wait for it to be sent, and you don't have multiple emails stacking on top of one another when different people want to send at the same time.
Re: Bulk Email Load balancing
by helphand (Pilgrim) on Mar 08, 2006 at 04:52 UTC

    1000 emails is not a lot of mail. Certainly not enough to saturate a network unless each of the emails is huge. Is the smtp server you are relaying through local or somewhere remote over a slow connection?


Re: Bulk Email Load balancing
by spiritway (Vicar) on Mar 08, 2006 at 05:06 UTC

    I think that some of the servers respond to large (for some value of "large") numbers of e-mails being sent through them, by deliberately slowing down the rate at which the messages are sent. The theory is that for a legitimate run of a few dozen or a few hundred, it isn't going to make that much difference - the delay isn't going to do any harm. To a spammer, it will make the connection almost useless. You may be running into a situation like this.

Re: Bulk Email Load balancing
by diggernz (Sexton) on Mar 10, 2006 at 11:03 UTC
    Thanks for your replies
    We are using an internal DNS and mail server (merak mail server). I am currently looping through a database and sending the emails. During the sending phase the network becomes very sluggish! Perhaps I need to adjust my wait() function and loop iterations to reach the potential of our mail server and ethernet capacity.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://535063]
Approved by ChemBoy
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2022-01-23 22:00 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (64 votes). Check out past polls.