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

Dear Monks,

Send mails without attachments works fine with Net::SMTP::TLS. However sent mails with attachment is not working for me. Please take a look of the sent mail at: http://www.pastebin.ca/1427683 and the received message at: http://www.pastebin.ca/1427684.

The code snipet i'm trying is:

print $msg; my $smtp = Net::SMTP::TLS-> new("X.X.X.X", Debug => 1, User => 'uuuuuu +', Password=> 'ppppp') or die "Net::SMTP::new: $!"; $smtp-> mail($from); $smtp-> recipient($to); $smtp-> data(); $smtp-> datasend($msg); $smtp-> dataend();
Please give me any help. Thanks in advance.

Replies are listed 'Best First'.
Re: Net::SMTP::TLS is splitting my messages!
by zwon (Abbot) on May 19, 2009 at 20:36 UTC

    You message is significantly changed, in order to do this Net::SMTP::TLS should be able to handle MIME, but I just have a quick look onto its sources and it uses only MIME::Base64. Maybe you should blame your SMTP server? Try to send message through some other SMTP server (preferably something simple, not Exchange), or just emulate it with socat or similar program and see if you receiving tampered message.

    Upd: added link to socat

      Thanks zwon for reply, i'd tried same code send an email with attachments to gmail with same results, so it seems is some issue with CPAN module.

      Just for the record: i'm using http://www.cleancode.org/projects/email/about to send email. so far seems it works.

      Thanks. Martin