in reply to How to send email using Email::MIME & Email::Sender::Simple?

After multiple tests, I can confirm that the issue happens only after packing the script into an exe. I used the below commands to pack the perl into exe. Can anyone help please?

Updated code:
#!/usr/bin/perl use strict; use warnings; use lib "C:\\Users\\magesh\\SF\\Personal Folders\\Material master\\Mat +erial_Master_Prod\\Test"; use plmconst ':constants'; use plm_sap_material_master_constant_definitions ':constants'; use Email::Stuffer; use Email::Sender::Transport::SMTP; use Email::MIME (); use Email::MIME::Creator (); use Email::Sender::Simple (); use Email::Sender::Role::CommonSending; use Email::Sender; use Email::MIME::Header::AddressList; use Throwable; use Throwable::Error; use StackTrace::Auto; use IO::All; my $msg_body .= "Hello this is test email"; Email::Stuffer ->html_body($msg_body) ->subject('Hello') ->from(SENDER_EMAIL) ->to('mzkuma@abc.com') ->transport(Email::Sender::Transport::SMTP->new ({ host => MAIL_SERVER, port => MAIL_SERVER_PORT, })) ->send;

To pack the above test.pl into exe, used below command

 pp -o test.exe test.pl

Also tried

 pp -u -o test.exe test.pl

Any leads would greatly help me. Thank you!

Replies are listed 'Best First'.
Re^2: How to send email using Email::MIME & Email::Sender::Simple?
by haukex (Archbishop) on May 03, 2020 at 18:22 UTC

    See my suggestions here: if you could show @INC for the script running from the command line and the script running from the exe, that might give some clues. Try also adding print $Email::Sender::VERSION; and seeing what that outputs, whether the versions are different. And also search the @INC paths in the filesystem for multiple installed copies of the corresponding Email:: modules, and their versions, and let us know.

      Hi Haukex,

      Thanks for your suggestion. I did verify the module versions of .pl vs .exe. But here's what I found and which resolved my issue, I packed the perl using following pp command

       pp -x -o test.exe test.pl

      -x in pp executed my perl script completely and identified all runtime dependencies on the fly, then gave a compatible exe. This resolved my problem.

      Thanks a lot again.