Pcore::API::SMTP - non-blocking SMTP protocol implementation
my $smtp = Pcore::API::SMTP->new( { host => 'smtp.gmail.com', port => 465, username => 'username@gmail.com', password => 'password', tls => 1, } ); # send email with two attachments $message_body = [ [ 'filename1.ext', \$content1 ], [ 'filename2.ext', \$content2 ] ]; $smtp->sendmail( from => 'from@host', reply_to => 'from@host', to => 'to@host', cc => 'cc@host', bcc => 'bcc@host', subject => 'email subject', body => $message_body, sub ($res) { say $res; $cb->(); return; } );
AnyEvent based SMTP protocol implementation.
Please, see "SYNOPSIS"
Where %args are:
from email address.
reply to email address.
This argument can be either Scalar or ArrayRef[Scalar].
Email subject.
Email body. Can be Scalar|ScalarRef|ArrayRef[Scalar|ScalarRef|ArrayRef].
If body is ArrayRef - email will be composed as multipart/mixed. Each part can be a $body or \$body or a [$headers, $body]. If $headers ia plain scalar - this will be a filename, and headers array will be generated. Or you can specify all required headers manually in ArrayRef.
$body
\$body
[$headers, $body]
$headers
Examples:
$body = 'message body'; $body = \'message body'; $body = [ 'body1', \$body2, [ \@headers, $content ] ]; # send email with two file attachmants $body = [ 'message body', [ 'filename1.txt', \$content1 ], [ 'filename2.txt', \$content2 ] ]; # manually specify headers # send HTML email with 1 attachment $body = [ [ ['Content-Type: text/html'], \$body ], [ 'filename1.txt', \$attachment ] ];
If you are using gmail and get error 534 "Please log in via your web browser", go to https://myaccount.google.com/lesssecureapps and allow less secure apps.
http://foundation.zurb.com/emails.html
https://habrahabr.ru/post/317810/
zdm <zdm@softvisio.net>
This software is copyright (c) 2016 by zdm.
To install Pcore, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Pcore
CPAN shell
perl -MCPAN -e shell install Pcore
For more information on module installation, please visit the detailed CPAN module installation guide.