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; }
In reply to Re^3: Multiple Recipients in email
by Anonymous Monk
in thread Multiple Recipients in email
by nephorm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |