in reply to Send Email With Picture Embedded in Body of Email (SOLVED)
Here is my attempt to add a section to embed the picture in the body of the email. Unfortunately, it does not work.
The email arrives with the raw base64 data displayed.
The email arrives with the raw base64 data displayed.
############################################################## # Embed JPG image in email body. # Note: This does NOT work. ############################################################## $smtp->datasend("MIME-Version: 1.0\n"); $smtp->datasend("Content-Type: text/html; boundary=$boundary\n"); $smtp->datasend("Content-Transfer-Encoding: base64\n"); $smtp->datasend("Content-Disposition: inline\n"); $smtp->datasend("\n"); $smtp->datasend("<body><img alt=\"My Picture\" img src=\""); open(my $fh2, '<', $pic) || die("Could not open Jpg file!"); binmode($fh2); local $/=undef; while (read($fh2, my $chunk, 72*57)) { my $buf = &encode_base64( $chunk ); $smtp->datasend($buf); } close($fh2); $smtp->datasend("\"></body>");
"It's not how hard you work, it's how much you get done."
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Send Email With Picture Embedded in Body of Email
by afoken (Chancellor) on Sep 10, 2020 at 15:01 UTC | |
by roho (Bishop) on Sep 10, 2020 at 15:21 UTC | |
by jeffenstein (Hermit) on Sep 10, 2020 at 15:51 UTC | |
by roho (Bishop) on Sep 10, 2020 at 20:58 UTC | |
Re^2: Send Email With Picture Embedded in Body of Email
by huck (Prior) on Sep 10, 2020 at 03:51 UTC | |
by roho (Bishop) on Sep 10, 2020 at 15:11 UTC |
In Section
Seekers of Perl Wisdom