Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

sending the same email more than once without connecting to smtp for every To adress

by pitbull3000 (Beadle)
on Aug 25, 2001 at 03:09 UTC ( #107753=perlquestion: print w/replies, xml ) Need Help??

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

im trying to write a newsletter script, and now i got the question,how can i send the email to all the recipients without connecting to smtp for every recipient. i.e. sending the mail once to my smtp server with an array of to adresses... is this possible and how? thanks all you wise men oliver
  • Comment on sending the same email more than once without connecting to smtp for every To adress

Replies are listed 'Best First'.
Re: sending the same email more than once without connecting to smtp for every To adress
by rchiav (Deacon) on Aug 25, 2001 at 03:18 UTC
    Actually, you can do it just as you described. Just pass an array to the "to" method...
    my $smtp = Net::SMTP->new($srv); $smtp->mail('root@localhost'); $smtp->to(@emails); $smtp->data(); $smtp->datasend("Your data goes here.\n"); ....
    Hope this helps..
    Rich
      ok cool i was on the right way, is there also the possibility to send attachments with net::smtp, i already read the docs but didnt find anything. is it like sendmail that i specify the header with "content type multipart/mixed...... boundary...." if yes, how is the syntax... ;.))
        For that, you're going to want to use MIME::Lite..

        All the info you're looking for is at that link.

        Hope this helps..
        Rich

Re: sending the same email more than once without connecting to smtp for every To adress
by dondelelcaro (Monk) on Aug 25, 2001 at 03:13 UTC
    Checkout Mail::Bulkmail which will help you out to do this.

    Update: I need to keep up with the previous posts on this subject. Rich's method is the way to go if you're already using Net::SMTP for smaller numbers of e-mail recipients.
      unfortunately mail::bulkmail isnt installed on the server of my isp, so i think i tr the solution with passing an arry to smtp
Re: sending the same email more than once without connecting to smtp for every To adress
by Trimbach (Curate) on Aug 25, 2001 at 06:18 UTC
    Sending your newsletter to everyone at once on a bcc: line instead of a to: line is also a possibility. One connection, one email, no fuss.

    Gary Blackburn
    Trained Killer

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2022-12-07 10:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?