in reply to Net:::SMTP and Attaching a xlsx

Thank you for your reply. I may be heading in the wrong direction. I believe that xlsx needs base64 encoding. I used the following to encode the data

.
my $buf; use MIME::Base64 qw(encode_base64); open(FILE, "$attachfile") or die "$!"; binmode(FILE); while (<FILE>){ $buf .=$_; } $buf = encode_base64($buf); $smtp->datasend($buf);

Is this the right direction. I did run it with the above change and recieve the same error as before

.

Replies are listed 'Best First'.
Re^2: Net:::SMTP and Attaching a xlsx
by Anonymous Monk on Nov 21, 2015 at 06:31 UTC
    No; you're avoiding mime::tools while trying to get someone to explain what/how it does -- why dance around the knowledge you say you want? Use mimetools and see what it does, look at the source to see how

      I am definitely open to using MIME::TOOLS although i have never used it before. Looking at it it looks like i should use the MIME::Decoder.

      $decoder = new MIME::Decoder 'base64' or die "unsupported"; $decoder->encode(\*STDIN, \*STDOUT);

      I have looked for an example on how use this due to not fully understanding the document. Do you by chance have an example that i could relate to the above scenario

        Thank you for pointing me in the right direction and helping make my first post here a learning experience. What i got to finally work for me was

        my $var; use MIME::Decoder; my $decoder = new MIME::Decoder 'base64' or die "unsupported"; open (my $fh, "<", $attachfile); open (my $STDOUT, '>', \$var); $decoder->encode($fh, $STDOUT); print $var; close $fh; close $STDOUT; $smtp->datasend($var);