Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Email lists (the Righteous sort)

by l2kashe (Deacon)
on Oct 18, 2002 at 20:35 UTC ( [id://206419]=note: print w/replies, xml ) Need Help??


in reply to Email lists (the Righteous sort)

I ran into something similar. My company has a few million customers, and we needed to send out mailings to all, or a portion of the client base, on a semi frequent basis.

I rolled my own solution, as opposed to using a module (Bad me!), but the appropriate answer is multiple rcpt to statements. Then if you want to you can craft your CC header, with all the addresses, or not (which on an aside is exactly how Bcc works, rcpt to recipient with no entry in cc header :)

Off the cuff code to illustrate the point, assuming that if $CC is defined, we will append the addresses, else they are Bcc'd
@users = &Get_Users_from_Db("$some_db"); while ( defined($usr = shift(@users)) ) { chomp($usr); # # Assume the rcpt and send methods appropriatly process the # reponse from the server also here we would add error # checking for properly formated email addie. # $smtp->rcpt("$usr"); $cc_head ? $cc_head .= ", $usr" : $cc_head = "$usr"; } print $smtp->send("DATA"); # # At this point we talk directly to the socket because the # smtp server does not repond with anything till we are done # $socket = $smtp->socket(); print $socket "From: $from\n"; print $socket "To: $list_name\n"; print $socket "CC: $cc_head\n" if ($CC && $cc_head); print $socket "Subject: $subject\n\n"; print $socket "@message_body\n\n"; $ok = $smtp->send('.'); &Some_Error_Routine("sending mail") if (!$ok);
Its just a basic rundown, but it shows the point. Also Ive had great results using Perl, and like I said I send emails in the millions, so 500 is a breeze. Also again I do not know the particulars of the modules implementation, but assume it was written by a far wiser man than I. It should support the rcpt or rcpt_to or something similar. Just make sure that if you are trying to Bcc the list that the module isnt going to append that info to the headers of the data section.

Happy hacking, and on a quasi OT comment 'death to spammers'.. ;)

/* And the Creator, against his better judgement, wrote man.c */

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (1)
As of 2024-04-16 16:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found