I saw this great question and answer on StackOverflow on embedding an image in an email. Unfortunately, the answerer didn't explain how to split the email with a boundary - he said he didn't know what the boundary was for.
This is what I tried:
    v_body := '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
  <head>  
    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-15"> 
  </head> 
  <body bgcolor="#ffffff" text="#000000"> 
    <img src="data:image/jpg;base64,------------090303020209010600070908' || v_image || '------------090303020209010600070908" /> 
  </body> 
</html>'; 
utl_mail.send('myemail.example.com', 
              'myemail.example.com',
              null,
              null, 
              'Image attachment test',
              v_body,
              'multipart/related; boundary="------------090303020209010600070908"',
              null);   
It sends the base64 string as raw characters instead of converting it into an image.
Then, I tried:
    v_body := 'This is a multi-part message in MIME format. 
--------------090303020209010600070908 
Content-Type: text/html; charset=ISO-8859-15 
Content-Transfer-Encoding: 7bit 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
  <head> 
    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-15"> 
  </head> 
  <body bgcolor="#ffffff" text="#000000"> 
    <img src="cid:part1.06090408.01060107" alt=""> 
  </body> 
</html> 
--------------090303020209010600070908 
Content-Type: image/png; 
 name="moz-screenshot.png" 
Content-Transfer-Encoding: base64 
Content-ID: <part1.06090408.01060107> 
Content-Disposition: inline; 
 filename="moz-screenshot.png" 
' || v_image || '
--------------090303020209010600070908-- '; 
utl_mail.send('myemail.example.com', 
              'myemail.example.com',
              null,
              null, 
              'Image attachment test',
              v_body,
              'multipart/related; boundary="------------090303020209010600070908"',
              null);   
The email content was not visible this time.
So, how can we split apart an email with a multipart/related MIME type using a boundary in Oracle?
 
     
    