in reply to Re^2: Multiple Recipients in email
in thread Multiple Recipients in email
Net::SMTPmostly cribbed from Email::Send::SMTP sub send { my ( $class, $message, @args ) = @_; my %args = @args; my ( $username, $password ) = @args{qw[username password]}; my $smtp = Net::SMTP::SSL->new( 'smtp.gmail.com', Port => 465, Debug => 0, ) || croak( 'Email::Send::Gmail: error connecting to server smtp.gmail.com +'); $smtp->auth( $username, $password ) or croak("Email::Send::Gmail: error authenticating username $user +name"); my @bad; eval { my $from = $class->get_env_sender($message); $smtp->mail($from) || croak("Email::Send::Gmail: error sending 'from' $from") +; my @to = $class->get_env_recipients($message); my @ok = $smtp->to( @to, { SkipBad => 1 } ) || croak("Email::Send::Gmail: error sending 'to' @to"); if ( @to != @ok ) { my %to; @to{@to} = (1) x @to; delete @to{@ok}; @bad = keys %to; } croak("Email::Send::Gmail: no valid recipients") if @bad == @t +o; }; croak($@) if $@; croak("Email::Send::Gmail: error sending data") unless $smtp->data( $message->as_string ); $smtp->quit || croak("Email::Send::Gmail: error sending 'quit'"); return 1; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Multiple Recipients in email
by nephorm (Novice) on Jan 24, 2009 at 18:09 UTC | |
by Anonymous Monk on Aug 12, 2009 at 07:55 UTC |