SaveHTMLEx - html use with Outlook

General TRichView support forum. Please post your questions here
Post Reply
BernhardRoos
Posts: 104
Joined: Mon Nov 26, 2007 1:49 pm

SaveHTMLEx - html use with Outlook

Post by BernhardRoos »

Hello,

I'm exporting in our application Richview Data to HTML like the following Code :

rv.RichView.SaveHTMLEx(sFile, '', 'image', '', '', '', [rvsoUseItemImageFileNames, rvsoOverrideImages, rvsoForceNonTextCSS]);

The html contains Images, which are saved in separated files. The Internet Explorer and the Google Chrome Shows the Images without Problems.

But Outlook Shows only empty shapes.

If I'm using absolute path for the Images then Outlook Shows on my Computer also the Images, but if I'm sending the mail then the receiver has only a red X and there is a text that the Image can't be foun (wrong Directory).

What have I to do that the Images are shown on the Sender Computer and on the receiver Computer? It is ok for me, if the receiver have to download the Image.

Best wishes
Bernhard
Sergey Tkachenko
Site Admin
Posts: 17534
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Images must be embedded in email together with HTML.
Normally, email clients use MIME email format for HTML emails.
We have examples how to send HTML email from Delphi application:
http://www.trichview.com/forums/viewtopic.php?t=11 (using Indy)
http://www.trichview.com/forums/viewtopic.php?t=4123 (using CleverComponents)

But sorry, I cannot make suggestions how to do it in a specific email client. I am sure there is a way to insert an image in email directly instead of a link to a file, but I do not know if Outlook supports it for images imported from an external HTML.
BernhardRoos
Posts: 104
Joined: Mon Nov 26, 2007 1:49 pm

Post by BernhardRoos »

Thanks for your answer.

But if I'm exporting a Report (which contains Richview Components) with eDocEngine, it works, although the Image files are separated files. But eDocEngine has other Problems, so I want to use the html Export of TRichview.

The difference of eDocEngine and TRichview is the following :

eDocEngine :
<div style="position: absolute; top: 2px; left: 5px; width: 151px; height: 151px;"><img style="position: absolute; top: 41px; left: 75px; width: 148px; height: 148px;" src="file://C:\Users\ROOS~1.SUN\AppData\Local\Temp\zeitarbeitdeluxe\20151102133548852_92656631\ReportBuilder.HTML_1_I.jpg" alt="" ></div>

RichView :
<p><img width=149 height=149 alt="" src="C:/Users/ROOS~1.SUN/AppData/Local/Temp/zeitarbeitdeluxe/20151102132158568_96100290/image1.jpg"></p>

The path is difference because this are only temp directories but the main difference is that in eDocEngine the path Begins with file:// and then it uses back slashes for the path. In TRichview it uses only slashes for the path and the file:// is missing.

I want to try if this makes a difference for Outlook. But I don't know what is to do that TRichview wites the imagepath in the same way.

Best wishes
Bernhard
BernhardRoos
Posts: 104
Joined: Mon Nov 26, 2007 1:49 pm

Post by BernhardRoos »

Now, I find the real difference. Please Forget my previous post.

Richview makes the following line :

<p><img width=149 height=149 alt="" src="d:/roostest/image1.jpg"></p>

This don't work with Outlook.
The following line works with Outlook :

<div><img style="width: 148px; height: 148px;" alt="" src="file://d:\roostest\image1.jpg"></div>

Is there a way that I can Change this line in my program? Sure I could parse the html, but perhaps there is a more simple way (I hope).

Best wishes
Bernhard
Sergey Tkachenko
Site Admin
Posts: 17534
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Are really width and height attributes and slashes important?
Probably, only 'file://' does matter.

Is this line ok with Outlook:
<div><img width=149 height=149 alt="" src="file://d:/roostest/image1.jpg"></div>

?
BernhardRoos
Posts: 104
Joined: Mon Nov 26, 2007 1:49 pm

Post by BernhardRoos »

Hello Sergey,

I've also tested this line with Outlook. But it doesn't work ok. Outlook only works ok with the style Attribute.

Also don't work "file://d:/roostest/image1.jpg". It must be "fille://d:\roostest\image1.jpg" (backslashes instead of slashes)

Best wishes
Bernhard
Sergey Tkachenko
Site Admin
Posts: 17534
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

If this is really so, it is a bug in Outlook.
1) <img>'s width and height are perfectly valid attributes, they are not even marked as "deprecated" in HTML specification
2) backslashes cannot be used in URL, the URLs like "file://d:\roostest\image1.jpg" are invalid.
The valid URL is file:///d:/roostest/image1.jpg (triple slash after file:)
MartinMCasey
Posts: 4
Joined: Mon Aug 08, 2016 2:49 pm

Post by MartinMCasey »

Hi Bernhard,
did you have any success in the end sending emails via Outlook - I have a similar problem (see my post yesterday).
Any assistance would be greatly appreciated...
Kind regards,
Martin Casey
Sergey Tkachenko
Site Admin
Posts: 17534
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Actually, local links to images are useless in emails (unless you send your HDD together with email :)). In HTML email, you can:
- refer to images on http server
- embed image directly in HTML (see http://www.trichview.com/forums/viewtopic.php?t=7191 )
- (recommended way) encode HTML and images in message using MIME (I believe Outlook uses the same format of HTML). It is implemented for CleverComponents in http://www.trichview.com/forums/viewtopic.php?t=4123

See also my answer in
http://www.trichview.com/forums/viewtopic.php?t=7191
Post Reply