Subject: | Email is not send if 'to' list contains an undefined value |
Date: | Wed, 18 Jul 2007 07:30:20 -0500 |
To: | <bug-Mail-Sender [...] rt.cpan.org> |
From: | "Kraenz, Helge (MDL FF)" <H.Kraenz [...] mdl.com> |
Hi everybody,
I'm using Mail::Sender "0.8.13" with perl "v5.8.7 built for sun4-solaris-thread-multi" on a solaris server: "SunOS solaris-ff6 5.9 Generic_118558-06 sun4u sparc SUNW,Sun-Fire-V440 Solaris".
I'm creating emails dynamically using a database to store the emails addresses (and many other things, of course). There is a third party web application allowing to change the email addresses, remove some or add some new. Sometimes these email addresses are left empty what results in a list with at least one undefined value in it. If I pass this list as the 'to'-list to the constructor, no mail is send and no error is reported.
The following example shows the same behaviour:
=== SNIP ===
#!/usr/local/bin/perl
use strict;
use Mail::Sender;
my $From = "nobody\@nowhere.com";
my $To = [ "nobody\@nowhere.com" , undef ]; # <<== THIS 'undef' CAUSES THE ERROR. THE MAIL IS SENT WITHOUT.
my $Cc = [ "nobody\@nowhere.com" ];
my $Bcc = [ "nobody\@nowhere.com" ];
my $SubMail = Mail::Sender->new( {
from => $From,
to => $To,
cc => $Cc,
bcc => $Bcc,
smtp => "localhost",
} );
if( $SubMail < 0 )
{
die $Mail::Sender::Error;
}
my $Subject = "SUBJECT";
my @Message = ();
push( @Message , "Dear reader" );
push( @Message , "" );
push( @Message , "please read the text" );
push( @Message , "" );
push( @Message , "End of mail" );
$SubMail->Open( { subject => $Subject } );
for my $Line ( @Message )
{
$SubMail->SendLineEnc( $Line );
}
$SubMail->Close();
if( $SubMail < 0 )
{
die $Mail::Sender::Error;
}
=== SNIP ===
Please let me know if you need some more detailed information.
Thanks in advance
Helge
===========================================================
Dr. Helge Kränz
Senior Software Engineer
Phone: +49-69-5050-4274
Fax: +49-69-5050-4266
E-mail: h.kraenz@mdl.com
Web: www.mdl.com, www.elsevier.com
MDL Information Systems GmbH
an Elsevier company
Address (Firmensitz):
Theodor-Heuss-Allee 108
60486 Frankfurt, Germany
Registration (Registergericht): Amtsgericht Frankfurt am
Main, HRB 57356, UST-ID-Nr.(VAT ID): DE813757333
Managing Directors (Geschäftsführer): Dr. Michiel Kolman,
Martin Tanke, Maarten van Wijngaarden, Dr. Gabriele Ilchmann