in reply to Re^2: Multiple Recipients in email
in thread Multiple Recipients in email

Something or other :) Copy this and turn on Debug. http://cpansearch.perl.org/src/LBROCARD/Email-Send-Gmail-0.33/lib/Email/Send/Gmail.pm
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

Replies are listed 'Best First'.
Re^4: Multiple Recipients in email
by nephorm (Novice) on Jan 24, 2009 at 18:09 UTC
    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.

      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.