in reply to Emailing attachments.

Can anyone tell me what am i doing wrong.

You forgot to binmode on line 42

Replies are listed 'Best First'.
Re^2: Emailing attachments.
by mailmeakhila (Sexton) on Jul 06, 2012 at 14:21 UTC
    I am not familiar with binmode. Is it something to do with encoding? Below is my code where i think the problem might be.
    my $msg = MIME::Lite->new( From => 'fromid', To => "toid", Subject =>'Web trial for today', Type => 'multipart/mixed', ); $msg->attach( Type => 'application/vnd.ms-excel', Path => '/root/Webtrial.xls', Id => 'Webtrial.xls', ); my $mailer = new Net::SMTP::TLS( 'smtp.gmail.com', Port => '587', User => 'username', Password => 'xxxxxxxxxxx' ); $mailer->mail('fromid'); $mailer->to('toid'); $mailer->data; $mailer->datasend($msg->as_string); $mailer->dataend; $mailer->quit;