Subject: | Attribute (password) is required |
Date: | Wed, 19 Jan 2011 21:36:40 +0000 |
To: | bug-Mail-Builder-Simple [...] rt.cpan.org |
From: | Stephen Fenwick-Paul <stephen [...] veggroup.org> |
My code:
use Email::Simple::Creator;
my $mail = Mail::Builder::Simple->new;
my (%cfg) = (
mail_client => {
mailer => 'SMTP::TLS',
mailer_args => {
host => "smtp.gmail.com",
ssl => 1,
username => "username@gmail",
password => "mypassword",
},
},
from => $args{from},
to => $args{to},
subject => $args{subject},
plaintext => $args{text};
);
eval { $mail->send(\%cfg) };
Which was producing:
Failed to send message to my@domain.org: Attribute (password) is
required at /usr/local/share/perl/5.8.8//Mail/Builder/Simple.pm line
257
Mail::Builder::Simple::send('Mail::Builder::Simple=HASH(0x1ac55450)',
'HASH(0x1ad46c30)') called at ./googlemail.pl line 104
eval {...} called at ./googlemail.pl line 104
Made the following change to Mail::Builder::Simple:
#Accept the old keys for compatibility with older versions:
$mailer_args{host} = delete $mailer_args{Host} if $mailer_args{Host};
$mailer_args{sasl_username} = $mailer_args{username} if $mailer_args{username};
$mailer_args{sasl_password} = $mailer_args{password} if $mailer_args{password};
#$mailer_args{sasl_username} = delete $mailer_args{username} if
$mailer_args{username};
#$mailer_args{sasl_password} = delete $mailer_args{password} if
$mailer_args{password};
and then it worked.
thanks
Stephen