mardi 21 juin 2016

How tell Outlook where image files are?

Please bear with me; there's a long story coming up. It's about programatically creating HTML e-mails from Delphi-7, sending them to Outlook, and not showing the pictures in it, so if you don't know anything about that, don't bother reading it all.

I have an application that sends variable-text E-mails, from a Delphi-7 program, to Outlook. I'm using a TMailInfo item, use a template HTML file for layout, replace placeholders with data from the program (%NAME% becomes "Johnson" etc), create a new Outlook message and populate HTMLbody with my result. All of this works fine.

Recently my client sent me a new sample message, asking me if I could change this E-mail to the new layout as he sent me. So I saved the E-mail as html (from Outlook, generating a huge HTML file full of code that is hardly understandable for a non-HTML guru like me)), replaced the static data with my placeholders, and saved it as the new template.

This worked fine except for one thing - the new layout included some local pictures (not available from a public web resource). When original sample mail from outlook, two things were created - a htm file with the html code, named "Subject" AND a folder called "Subject_files", containing the picture files plus a filelist.xml and an mso file.

The generated HTML refers to the pictures as src="subject_files/image001.jpg"> etc.

When I send the HTML to Outlook, it obviously has no idea where the images are - but how do I tell him?

What I tried:

  • copying the "subject_files" folder to "My Documents"

  • hardcoding the links to the pictures in several formats (i.e.

src="C:/test/subject_files/image001.jpg",

src="C://test/subject_files/image001.jpg",

src="C:testsubject_filesimage001.jpg",

and the like

but both don't work... so my question is really, how do I tell Outlook where to look for image files when programatically creating an HTML message?

Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire