Subject: | I believe there is a problem with Email:Send:SMTP:Gmail and attachments on linux machines |
Date: | Thu, 29 Jan 2015 23:05:51 +0000 |
To: | bug-Email-Send-SMTP-Gmail [...] rt.cpan.org |
From: | "Godart-Brown, Giles" <giles [...] godartbrown.co.uk> |
I have a min repro case that works fine on windows but throws an error when run on Linux and Mac. I believe it is linked to bare line endings.
This is the sample code;
<code>
use strict;
use warnings;
use Email::Send::SMTP::Gmail;
my $username = ‘user@gmail.com';
my $password = ‘password';
my $to = ‘recipient@somewher.com';
my $from = 'user@gmail.com';
my $subject = 'Test';
my $attachment = “/pathtoapdffile/indata.pdf";
my $thisLetter = "hello world <br> line 2";
my $mail = Email::Send::SMTP::Gmail->new(
-smtp => 'smtp.gmail.com',
-login => ‘user@gmail.com',
-pass => ‘password',
-layer => 'ssl',
-port => 465,
# -debug => 1,
);
$mail->send(
-to => $to,
-subject => $subject,
# -verbose => '1',
-contenttype=>'text/html',
-body => $thisLetter . '<br><br>',
-attachments => $attachment
);
$mail->bye;
</code>
gives the following error on linux and Mac;
…
Net::SMTPS=GLOB(0x7fa89c0007c8)>>> CjI0NDI5CiUlRU9GCg==
Net::SMTPS: Net::Cmd::datasend(): unexpected EOF on command channel: at /Library/Perl/5.16/Email/Send/SMTP/Gmail.pm line 328.
at the end of the pdf file.
I’m using Perl 5.16 and have Email::Send::SMTP::Gmail is up to date (0.88).
Have I missed anything?
Thanks
Giles