mostly 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;
}
Net::SMTP
| [reply] [d/l] |
That was a good point, so I attempted to do what you suggested. Strangely enough... it didn't give the error when I called my own version of that function.
This left the Bcc problem I was having as unresolved, and when I added Bcc recipients via the header command, I got emails to all listed, but the list of recipients was visible to everyone. So, looking back through the Net::SMTP documentation, I saw that email::send::gmail does not a make call like:
$stmp->bcc(@recips,{SkipBad=>1});
and instead stuffs everything into the "to" recipients.
Long story short(er), I rewrote the send routine to properly parse out the bccs, remove them from the header, etc, and everything seems to be working, now.
Thanks for the help. | [reply] [d/l] |
So, in other words, there is still no idea why Email::Send::Gmail cannot handle multiple entries in the To: header or Cc: headers? Someone should file a bug report with creator and see if something happens.
| [reply] |