Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Images within HTML emails (for a mac)

Posted on 2011-03-16
7
Medium Priority
?
343 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 2000 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
Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

 

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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

782 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