From the script below, the commented part of the script is to prevent the script from hanging. The script as is , is working once I uncomment the openning of the file to retieve the body of the email, the script hang.    

  use Email::Send;
use Email::Send::Gmail;
use Email::Simple::Creator;

# open the file that contains the body of the email
# local $/ = undef;
# open(FH,'<','body.txt') or die "file does not exists $!";
# my $body=<FH>;
# close(FH); 

  my $email = Email::Simple->create(
      header => [
          From    => 'arishy@gmail.com',
          To      => 'arishy@gmail.com',
          Subject => 'testing sent mail to gmail',
      body => 'this is the body that works',
      ## if I uncomment the openning of a file to get the body of the email
      ## like this  body => $body,

  my $sender = Email::Send->new(
      {   mailer      => 'Gmail',
          mailer_args => [
              username => 'arishy@gmail.com',
              password => 'xxxxxxxxx',
  eval { $sender->send($email) };
  die "Error sending email: $@" if $@;
4 Years
Discussion Span
Last Post by arishy

for your codes line numbered 7-11, replace with this:

#open the file that contains the body of the email
open(FH,'<','body.txt') or die "file does not exists $!";
my $body=do{ local $/ = undef;<FH>};

then code line numbered 19-21 then do this:
body => $body,
it should work.


As expected, worked.!!
This is a very hard to find bug, T thought the local $/ = undef, was enough to get the whole file ( which it did !! I checked that...) but this action affected the next part of the script; The object $mail DID NOT SEE the $body and it hanged.

Just to give you an idea why I am doing all that in case you advice me to change it.
I am accessing my bank statement using Mechanize, but the content I get is not what the statement shows ( very heavy JS stuff). If I go manually and login and save the page with IE I get nothing, but with firefox I get the report. (very weired). I need the data from the report to come up with proper anaylsis that the report does not give me.
So, I decided to get in manually (sadly) and select the report copy it to a text file.
That was ONE of the files that I read by the script I listed.
The full script takes the "body" do some calculations ( a lot ) then send me an email with the "proper" reporting.

As you can see, I am doing all the hard work manually which I do not like. I have the script that goes automatically to my account and retrieve the report ( rubbish).

Because of my lack of experience in tackling this high level debugging I am stuck with the manual way.

My hope really is to retieve the report data but I do not how ( the idea that firefox managed to save the report properly, give hope that it is possible ) what do you advice me to do.

Thank you again for you help and wonderfull support

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.