我必须将存储在OLE对象字段的Access表中的图像插入到Outlook html电子邮件的正文中。
我正在使用字符串变量strBOD构建html:
strBOD = strBOD & "<tr>" & "<img src=""smiley.gif"" alt=""Smiley face"" height=""42"" width=""42"">" & "</tr>"
我需要用OLE对象替换上面示例中的“ smiley.gif”。
您必须将图像存储在任何人都可以快速到达的位置。否则,您将必须使用嵌入式图像来构建MIME消息,该图像更加复杂并且可能会使该消息膨胀。
我们使用Imgur存储图像。这是免费,快速的,并且将“永远运行”。
这里是一个用作我的签名的文件的示例:
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="da" charset="iso-8859-1"> <head> <title>E-mailsignatur Cactus Data ApS</title> </head> <body style="font-family: calibri, 'segoe ui', helvetica, arial, sans-serif"> <span style="font-size: 11pt"> Venlig hilsen / Best regards / Freundlichen Grüßen<br> Gustav Brock </span> <hr> <p style="text-align: center; margin-top: 10px; margin-bottom: 0px;"> <img src="https://i.imgur.com/HbdRTBD.gif" alt="Cactus Data ApS" title="Cactus Data ApS" /><br> <span style="font-size: 9pt;"> Kalkbrænderiløbskaj 4 A · 2100 København Ø · Danmark<br> CVR/VAT: DK12002696 · Telefon: +45 39 29 49 48 · E-mail: <a title="[email protected]" href="mailto:Gustav%20Brock%20%[email protected]%3e?subject=Re:%20E-mail">Gustav Brock</a> </span> </p> <hr> </body> </html>
完成并经过仔细测试(非常重要,因为Outlook不能完全像常见的浏览器一样呈现,创建VBA来重新创建它很简单。
或者,或者按照我们的做法,将完整的HTML存储在注释(长文本)字段中,并在创建电子邮件时进行检索。
使用Outlook对象模型?参见Including Pictures in an Outlook Email