fredscripts
October 25th, 2008, 10:50 PM
Hi!
I found this module in order to send a simple email using a gmail account in Perl
http://search.cpan.org/~lbrocard/Email-Send-Gmail-0.33/lib/Email/Send/Gmail.pm
Running the synopsis-like code to test it:
#!/usr/bin/perl
use strict;
use warnings;
use Email::Send;
use Email::Send::Gmail;
use Email::Simple::Creator;
use Carp;
my $email = Email::Simple->create(
header => [
From => 'myaccount@gmail.com',
To => 'myaccount@hotmail.com',
Subject => 'hello email::send::gmail',
],
body => 'will Email::Send::Gmail fail? y/n',
);
my $sender = Email::Send->new(
{ mailer => 'Gmail',
mailer_args => [
username => 'myaccount@gmail.com',
password => 'mypassword',
]
}
);
eval { $sender->send($email) };
confess "Error sending email: $@" if $@;
print "success\n";
All modules installed successfully, but when I run it:
Error sending email: Email::Send::Gmail: error authenticating username
+ myaccount at /usr/local/share/perl/5.8.8/Email/Send.pm line 243
at ./sendemail.pl line 29
Acces to gmail is fine:
telnet smtp.gmail.com 995 -> Trying 216.239.59.109... Connected to gmail-smtp-msa.l.google.com
Besides,that this code runs perfectly in a Leopard plataform (Mac OS X). And even more surprising, it runs perfectly on the Ubuntu 8.04 that I have installed in the macbook (in a different partition). So it really freezes me because the problem is specific of my PC.
Anyone have any idea why it fails? (I've also started a thread in perlmonks,http://www.perlmonks.org/?node_id=719444)
It would be interesting to test some network commands here on the PC and on the mac ubuntu partition to really see the differences between plataforms and realize why this script works on a macbook and not on a normal PC.
Thank you very much in advance!!!
I found this module in order to send a simple email using a gmail account in Perl
http://search.cpan.org/~lbrocard/Email-Send-Gmail-0.33/lib/Email/Send/Gmail.pm
Running the synopsis-like code to test it:
#!/usr/bin/perl
use strict;
use warnings;
use Email::Send;
use Email::Send::Gmail;
use Email::Simple::Creator;
use Carp;
my $email = Email::Simple->create(
header => [
From => 'myaccount@gmail.com',
To => 'myaccount@hotmail.com',
Subject => 'hello email::send::gmail',
],
body => 'will Email::Send::Gmail fail? y/n',
);
my $sender = Email::Send->new(
{ mailer => 'Gmail',
mailer_args => [
username => 'myaccount@gmail.com',
password => 'mypassword',
]
}
);
eval { $sender->send($email) };
confess "Error sending email: $@" if $@;
print "success\n";
All modules installed successfully, but when I run it:
Error sending email: Email::Send::Gmail: error authenticating username
+ myaccount at /usr/local/share/perl/5.8.8/Email/Send.pm line 243
at ./sendemail.pl line 29
Acces to gmail is fine:
telnet smtp.gmail.com 995 -> Trying 216.239.59.109... Connected to gmail-smtp-msa.l.google.com
Besides,that this code runs perfectly in a Leopard plataform (Mac OS X). And even more surprising, it runs perfectly on the Ubuntu 8.04 that I have installed in the macbook (in a different partition). So it really freezes me because the problem is specific of my PC.
Anyone have any idea why it fails? (I've also started a thread in perlmonks,http://www.perlmonks.org/?node_id=719444)
It would be interesting to test some network commands here on the PC and on the mac ubuntu partition to really see the differences between plataforms and realize why this script works on a macbook and not on a normal PC.
Thank you very much in advance!!!