简体   繁体   中英

base64 encoded images in email signatures for microsoft outlook 2003 and 2010 and gmail

I need help with how to integrate image in HTML page and send it to mail. I saw few mail on stack exchange and online but were of no help as they were very high level description and resolution. I tried below but no luck. Anyone who might be able to help as what went wrong and how can i create a script or send mail, i tried below:

From: test.mail@server.com
To: atul.path@server.com
Subject: HTML Messages with Embedded Pic in Signature
MIME-Version: 1.0
Content-Type: multipart/related; 
boundary="multipart_related_boundary"

--multipart_related_boundary
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html>
<html>
<head>
</head>
<body>
<img alt="Image of alok" src="cid:0123456789">
</body>
</html>

--multipart_related_boundary
Content-Type: image/jpeg; name="alok.jpeg"
Content-Transfer-Encoding: base64
Content-Location: sig.png
Content-ID: <0123456789>
Content-Disposition: inline; filename="alok.jpeg"
Qk3m2QAAAAAAADYAAAA/v7+/////////////////////v7++vr67e3t2NjYHR0dAAAAAAAAAQEBAgICAwMDBAQEBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBDREAMD/AZHABQUFAang// ) | sendmail -t

I suppose you can use the Outlook object model to get the job done.

You need to add an attachment using the Add method of the Attachments class. Use the default value - olByValue (the attachment is a copy of the original file and can be accessed even if the original file is removed).

Then set the PR_ATTACH_CONTENT_ID property (DASL name is http://schemas.microsoft.com/mapi/proptag/0x3712001F ) using the SetProperty of the PropertyAccessor class. The Attachment class provides a corresponding property to get an instance of the PropertyAccessor class. You can use any value. Be aware, the value will be used to refer to the attached item in the HTML markup in the following format:

 <img src="cid:tatata"/>

where tatata is the value of the PR_ATTACH_CONTENT_ID property.

Finally, you may find the Getting Started with VBA in Outlook 2010 article helpful.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM