【发布时间】:2012-03-22 22:13:04
【问题描述】:
我在 StackOverflow 上看到了这个 great question and answer 在电子邮件中嵌入图像。不幸的是,回复者没有解释如何用边界分割电子邮件 - 他说他不知道边界的用途。
这是我尝试过的:
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);
它将 base64 字符串作为原始字符发送,而不是将其转换为图像。
然后,我尝试了:
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);
这次邮件内容不可见。
那么,我们如何在 Oracle 中使用边界分割具有多部分/相关 MIME 类型的电子邮件?
【问题讨论】:
标签: image oracle email plsql mime