Solved

Images within HTML emails (for a mac)

Posted on 2011-03-16
7
331 Views
Last Modified: 2012-08-13
I have an Access database that can send out basic, html emails (via CDO, on a PC).  This works fine when receiving an email on a PC, but when sent to a mac the images are not where they should be (they are at the bottom of the screen). The image then has a ? place holder instead.

To insert the image into the html file I use something like:

<img src="Image.JPG" width="200" height="87" />

and then attach the image file to the email.

Is there a better way (I'm sure there is)????
0
Comment
Question by:Andy Brown
  • 4
  • 3
7 Comments
 
LVL 8

Accepted Solution

by:
et01267 earned 500 total points
ID: 35149970
You need to create multipart MIME messages

The part with the image needs to have a header like this:

Content-Type: image/jpeg; x-mac-type="0"; x-mac-creator="0";
 name="IMG_0055.jpg"
Content-Transfer-Encoding: base64
Content-ID: <something-unique>
Content-Disposition: inline;
 filename="IMG_0055.jpg"

and then you reference the image in the body of the message like this

<img src="cid:something-unique">

0
 

Author Comment

by:Andy Brown
ID: 35150520
Thank you for this - really appreciated.  Just a couple of things.

1) Is this script put into the HTML page sent
2) Will have any affect on the PC version (which seems to work ok)?

Thanks again.
0
 
LVL 8

Expert Comment

by:et01267
ID: 35151075
I'm not sure what you are asking in (1).  

If you are asking about the HTML email body, then I guess you need to embed the <img> tag inside whatever element you have to contain it like a <div> or a <table> or whatnot.

If you are asking about the MIME headers, they need to go at the top of the part containing the image, right after the magic divider that separates the parts (looks like "--------------070506030601060606090504
", for example).

But your email sender must have the ability to formulate multipart MIME and have ways of setting the header values, right?

For (2), as long as you have a valid multipart MIME message then the PC should read it correctly.
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:Andy Brown
ID: 35151344
Brilliant - does anyone have any hyperlinks to a basic example that I can draw from?
0
 
LVL 8

Expert Comment

by:et01267
ID: 35151451
I've attached an email I composed on my mail program with an image embedded
test.txt
0
 

Author Comment

by:Andy Brown
ID: 35154673
Ahh, it looks like I need to do a little more reading.  Creating the html content and sending it as an email is easy, however, converting the image files to a MIME type and then how to place them has completely stumpped me.
0
 

Author Closing Comment

by:Andy Brown
ID: 35154921
Thank you so much for your help on this.  I am going to re-word this post and see if I can get any further, but the fact that you pointed me into the MIME direction was a big help.

Thanks again.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now