Skip Menu |

This queue is for tickets about the Email-Send-SMTP-Gmail CPAN distribution.

Report information
The Basics
Id: 104137
Status: resolved
Priority: 0/
Queue: Email-Send-SMTP-Gmail

People
Owner: Nobody in particular
Requestors: devin [...] nacredata.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.96



Subject: Inline (embedded) Images
Date: Thu, 30 Apr 2015 20:41:52 -0400
To: bug-Email-Send-SMTP-Gmail [...] rt.cpan.org
From: "Devin Ceartas" <devin [...] nacredata.com>
Perl 5.20.2 Email::Send::SMTP::Gmail 0.96 I found the following diff useful in sending embedded images, e.g. using the HTML such as: <body><img src="cid:logo.png"><br>Test with Image</body> devin -- contact info: http://nacredata.com/devin --- Gmail.orig Thu Apr 30 20:14:56 2015 +++ Gmail.pm Thu Apr 30 20:35:42 2015 @@ -285,7 +285,13 @@ { print "With Attachments\n" if $verbose; $self->{sender}->datasend("MIME-Version: 1.0\n"); - $self->{sender}->datasend("Content-Type: multipart/mixed; BOUNDARY=\"$boundary\"\n"); + if ('inline' eq lc($properties{'-disposition'})) { + $self->{sender}->datasend("Content-Type: multipart/related; BOUNDARY=\"$boundary\"\n"); + } + else { + $self->{sender}->datasend("Content-Type: multipart/mixed; BOUNDARY=\"$boundary\"\n"); + } + # Send text body $self->{sender}->datasend("\n--$boundary\n"); @@ -312,7 +318,13 @@ $self->{sender}->datasend("--$boundary\n"); $self->{sender}->datasend("Content-Type: $contentType; name=\"$fileName\"\n"); $self->{sender}->datasend("Content-Transfer-Encoding: base64\n"); - $self->{sender}->datasend("Content-Disposition: attachment; =filename=\"$fileName\"\n\n"); + if ('inline' eq lc($properties{'-disposition'})) { + $self->{sender}->datasend("Content-ID: <$fileName>\n"); + $self->{sender}->datasend("Content-Disposition: inline; =filename=\"$fileName\"\n\n"); + } + else { + $self->{sender}->datasend("Content-Disposition: attachment; =filename=\"$fileName\"\n\n"); + } # Google requires us to divide the attachment # First read -> Encode -> Send in chunks of 76 @@ -361,7 +373,13 @@ $self->{sender}->datasend("--$boundary\n"); $self->{sender}->datasend("Content-Type: $contentType; name=\"$fileName\"\n"); $self->{sender}->datasend("Content-Transfer-Encoding: base64\n"); - $self->{sender}->datasend("Content-Disposition: attachment; =filename=\"$fileName\"\n\n"); + if ('inline' eq lc($properties{'-disposition'})) { + $self->{sender}->datasend("Content-ID: <$fileName>\n"); + $self->{sender}->datasend("Content-Disposition: inline; =filename=\"$fileName\"\n\n"); + } + else { + $self->{sender}->datasend("Content-Disposition: attachment; =filename=\"$fileName\"\n\n"); + } # Google requires us to divide the attachment # First read -> Encode -> Send in chunks of 76
Hi, Thank you for your patch! It's applied to the release 0.98. Please, could you test it? (it's attached). I've also added you to the Authors list at POD. Please, confirm you agree and everything is ok. Peco On Thu Apr 30 20:42:09 2015, devin@nacredata.com wrote: Show quoted text
> Perl 5.20.2 > > Email::Send::SMTP::Gmail 0.96 > > I found the following diff useful in sending embedded images, e.g. using > the HTML such as: > > <body><img src="cid:logo.png"><br>Test with Image</body> > > > devin > -- > contact info: http://nacredata.com/devin > > > > > --- Gmail.orig Thu Apr 30 20:14:56 2015 > +++ Gmail.pm Thu Apr 30 20:35:42 2015 > @@ -285,7 +285,13 @@ > { > print "With Attachments\n" if $verbose; > $self->{sender}->datasend("MIME-Version: 1.0\n"); > - $self->{sender}->datasend("Content-Type: multipart/mixed; > BOUNDARY=\"$boundary\"\n"); > + if ('inline' eq lc($properties{'-disposition'})) { > + $self->{sender}->datasend("Content-Type: multipart/related; > BOUNDARY=\"$boundary\"\n"); > + } > + else { > + $self->{sender}->datasend("Content-Type: multipart/mixed; > BOUNDARY=\"$boundary\"\n"); > + } > + > > # Send text body > $self->{sender}->datasend("\n--$boundary\n"); > @@ -312,7 +318,13 @@ > $self->{sender}->datasend("--$boundary\n"); > $self->{sender}->datasend("Content-Type: $contentType; > name=\"$fileName\"\n"); > $self->{sender}->datasend("Content-Transfer-Encoding: > base64\n"); > - $self->{sender}->datasend("Content-Disposition: attachment; > =filename=\"$fileName\"\n\n"); > + if ('inline' eq lc($properties{'-disposition'})) { > + $self->{sender}->datasend("Content-ID: <$fileName>\n"); > + $self->{sender}->datasend("Content-Disposition: inline; > =filename=\"$fileName\"\n\n"); > + } > + else { > + $self->{sender}->datasend("Content-Disposition: > attachment; =filename=\"$fileName\"\n\n"); > + } > > # Google requires us to divide the attachment > # First read -> Encode -> Send in chunks of 76 > @@ -361,7 +373,13 @@ > $self->{sender}->datasend("--$boundary\n"); > $self->{sender}->datasend("Content-Type: $contentType; > name=\"$fileName\"\n"); > $self->{sender}->datasend("Content-Transfer-Encoding: > base64\n"); > - $self->{sender}->datasend("Content-Disposition: attachment; > =filename=\"$fileName\"\n\n"); > + if ('inline' eq lc($properties{'-disposition'})) { > + $self->{sender}->datasend("Content-ID: <$fileName>\n"); > + $self->{sender}->datasend("Content-Disposition: inline; > =filename=\"$fileName\"\n\n"); > + } > + else { > + $self->{sender}->datasend("Content-Disposition: > attachment; =filename=\"$fileName\"\n\n"); > + } > > # Google requires us to divide the attachment > # First read -> Encode -> Send in chunks of 76 > > > >
Subject: Gmail.pm

Message body is not shown because it is too large.

Tested and resolved