Hello monks
I need to send (SMTP) an email from a perl script packed in an exe. I've been able to achieve my goal with Email::Sender and the code below. However, I have problems in packaging it using ActivePerl/PerlApp since - no matter how many tricks I use (manually adding modules, etc.) - I end up missing the module Email::Sender::Role::CommonSending (Error: Can't locate Email/Sender/Role/CommonSending.pm in @INC). It is installed, it is scanned by PerlApp (added manually)... but the exe is missing it. The second script throughs error, but it doesn't say what is wrong.
Now I am searching for an alternative to the modules Email::Sender and Email::Send::SMTP::Gmail. What can you suggest?
This is the code I can not pack in exe(I can not switch to pp, sorry)
use strict; use warnings; use Email::Sender::Simple qw(sendmail); use Email::Sender::Transport::SMTP (); use Email::Simple::Markdown; use Email::Simple::Creator (); my $smtpserver = 'Myserver'; my $smtpport = 25; my $smtpuser = 'mail@mail.com'; my $smtppassword = '0123456789'; my $transport = Email::Sender::Transport::SMTP->new({ host => $smtpserver, port => $smtpport, sasl_username => $smtpuser, sasl_password => $smtppassword, }); my $email = Email::Simple::Markdown->create( header => [ To => 'mail@gmail.com', From => 'mail@mail.com', Subject => 'Subject', ], body => "My body", ); sendmail($email, { transport => $transport });
This is the code with Email::Send::SMTP::Gmail which I can pack but it doesn't work stable for me (error is printed out but $error is empty , so I cannot understand what is wrong)
use strict; use warnings; use Email::Send::SMTP::Gmail; my ($mail,$error) = Email::Send::SMTP::Gmail->new( -layer =>'tls', -port =>'25', -smtp =>'myserver(not gmail)', -login =>'mail@gmail.com', -pass =>'?????' ); die "session error: $error" if $mail ==-1; $mail->send( -to =>'mail@gmail.com', -subject =>'Hello!', -body =>'Just testing it', ); $mail->bye;
What are good alternatives (and possibly easy to use)? Thank
In reply to Alternative to Email::Sender by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |