http://qs321.pair.com?node_id=11121560


in reply to Re^3: Send Email With Picture Embedded in Body of Email
in thread Send Email With Picture Embedded in Body of Email (SOLVED)

Have you tried building the message with MIME::Lite, and converting it to a string to send with Net::SMTPS?

Borrowing from afoken's post:

$msg = MIME::Lite->new( To =>'you@yourhost.com', Subject =>'HTML with in-line images!', Type =>'multipart/related' ); $msg->attach( Type => 'text/html', Data => qq{ <body> Here's <i>my</i> image: <img src="cid:myimage.gif"> </body> }, ); $msg->attach( Type => 'image/gif', Id => 'myimage.gif', Path => '/path/to/somefile.gif', ); $msg->send();

But replacing $msg->send(); with $smtp->datasend($msg->as_string).

In practice it might be more complicated since you will have to check for lines with a single period (untested):

$smtp->datasend( join "\n", map { $_ eq "." ? ".." : $_ } split "\n", $msg->as_string );