Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: fork() and batch processing mail (was: Quicker array processing)

by flyboy (Novice)
on Jun 29, 2002 at 08:36 UTC ( [id://178220]=note: print w/replies, xml ) Need Help??


in reply to fork() and batch processing mail (was: Quicker array processing)

I just got done writing an application that does exactly what you want to do. I will give you this one bit of advice. Don't use a foreach loop, like:
for my $email (@emails){
    #fork();
}

I suggest this:
while (@emails){
    my $email = shift(@emails);
    #fork();
}

It will reduce memory usage. At least over time. I'm sure there is a better way, but it works for me.

To handle the message array processing. I set up @mime_data, @text_data array's. Then in my send code something like this:
for (@mime_data){
    s/PATTERN/$var/g;
    push(@foo,$_);
}
Net::SMTP->data("To: $email",@foo);
So I obviously use Net::SMTP. That is the only module I use, I suggest you do the same unless you want to bloat your code - or you know more than I do. :)
  • Comment on Re: fork() and batch processing mail (was: Quicker array processing)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://178220]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-25 02:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found