Wednesday, November 28, 2007

Email::Send::SMTP::TLS

I wrote a new CPAN module Email::Send::SMTP::TLS.
it can use Gmail smtp.gmail.com to send email, and it runs well under Win32.

I tried Email::Send::Gmail, but it's not working in my computer at all.

example:

use Email::Send;

my $mailer = Email::Send->new( {
mailer => 'SMTP::TLS',
mailer_args => [
Host => 'smtp.gmail.com',
Port => 587,
User => 'username@gmail.com',
Password => 'password',
Hello => 'fayland.org',
]
} );

use Email::Simple::Creator; # or other Email::
my $email = Email::Simple->create(
header => [
From => 'username@gmail.com',
To => 'to@mail.com',
Subject => 'Subject title',
],
body => 'Content.',
);

eval { $mailer->send($email) };
die "Error sending email: $@" if $@;

Labels:

2 Comments:

Anonymous Anonymous said...

The Simple::Email::Creator method is not available to me. I installed Email::Simple.

C:\_download>test_email.pl
Can't locate Email/Simple/Creator.pm in @INC (@INC contains: C:/Perl/site/lib C:
/Perl/lib .) at C:\_download\test_email.pl line 14.
BEGIN failed--compilation aborted at C:\_download\test_email.pl line 14.

5/28/2008 11:12 AM  
Blogger Fayland said...

u should install Email::Simple::Creator too

http://search.cpan.org/~rjbs/Email-Simple-Creator-1.424/lib/Email/Simple/Creator.pm

Thanks.

5/28/2008 12:25 PM  

Post a Comment

Links to this post:

Create a Link

<< Home