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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.