Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Alternative to Email::Sender

by Anonymous Monk
on Feb 15, 2018 at 14:14 UTC ( [id://1209222]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

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

Replies are listed 'Best First'.
Re: Alternative to Email::Sender
by Anonymous Monk on Feb 16, 2018 at 11:26 UTC
    Show your exe packer commands...Learn to work your exe packer... I think that covers it

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1209222]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-03-28 20:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found