cacharbe has asked for the wisdom of the Perl Monks concerning the following question:
Can I use the same method with MIME::Lite - sending an array of addresses - and what do I have to do differently?
After reading through the MIME::Lite docs, I found no mention of this functionality, but that doesn't necessarily mean that it doesn't exist.
The two pieces of mail code are munged together and included below, for posterity. It doesn't represent the application, merely an example of what I am speaking.
use MIME::Lite; use Net::SMTP; my @addrlist = (<BIG ASS LIST OF ADDRS>); my $msg = "<A HUGE MSG, 100's of lines Long>"; &EMailSMTP(\@addrlist,\$msg) || die "Couldn't SMTP :$!\n"; &EMailMIME(\@addrlist,\$msg) || die "Couldn't MIME :$!\n"; sub EMailSMTP { my ($addrs, $Lusertxt) = @_; @headers = ("Subject: Subject Text.\n", "To : To Mask \n", "From : me\@here.com\n", "\n", "$$Lusertxt\n"); my $smtp = Net::SMTP->new('mailserver.com') || die "Nope!! No SMTP +:$!\n"; $smtp->mail("fromaddr\@here.com"); $smtp->to(@$addrs); $smtp->data(@headers) ; $smtp->quit; return 1; } sub EMailMIME{ my ($addrs, $Lusertxt) = @_; MIME::Lite->send('smtp', "mailserver.com", Timeout=>60); foreach my $addr (@$addrs){ my $msg = MIME::Lite->new( From =>'someaddr@here.com', To =>$addr, Subject =>"Subject Text", Type =>'TEXT', Data => $$Lusertxt ); $msg->send(); } return 1; }
FYI: This is on a Win2k Advanced Server Machine, using AS Perl, and SMTP services from our corporate mail server.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sending msgs with MIME::Lite vs NET::SMTP to a list of addrs
by chromatic (Archbishop) on Sep 20, 2001 at 05:18 UTC | |
by cacharbe (Curate) on Sep 20, 2001 at 16:12 UTC |