We have a request to email an embedded image chart (*.png) in the email body from Oracle 11g to Outlook2010( which used by our company).
Currrently I am able to do the following,
- use " img src"
tag to specify the reference to the image file in the email HTML body, BUT user cannot see the image if they don't have permission to the file folder.
- send an email to users with the attached image file, BUT user perfers to view the image in the email body as well.
In order to make it inline, I tried two approaches, none is working in Outlook
1. Firstly, Using Oracle's UTL_SMTP, I was able to produce html file with the following output
<html><head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Test HTML with Embedded Image</title> </head> <body> <h1>Test HTML with Embedded Image 1720</h1> <p>And here it is:</p> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAA7QAAAEdCAYAAAA8SyuhAABDQElEQVR42u2deXBU V37vU/ybTKYmk8ofqXp59ZZkDKgldQubN0ga7EniZN6kPOPxGzvxBsbG8jZex/vG pgUkgdhsAbbMMmAjYxsECMy+YwMGr4xjknozVW/yqjJVVPJH8gf54/fuuejwjo7P ...... .....=" alt="Test png"> <p>The end.</p> </body> </html>
2.Secondly, I constructed HTML according to MIME and content ID standard. Still not able to show the image in the Outlook email either
In Outlook, the source looks like this
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head> <body background="cid:test.png@01CBB95B.9A1FD110"> .rest of mail </body> </html>
In the HTML file, the source looks like this:
MIME-Version: 1.0 To: myvalidemailaddress From: myvalidemailaddress Subject: Test Message Reply-To:myvalidemailaddress Content-Type: multipart/alternative; boundary="a1b2c3d4e3f2g1" --a1b2c3d4e3f2g1 content-type: text/plain; charset=us-ascii This is a test message. --a1b2c3d4e3f2g1 Content-type: text/html; charset=us-ascii Content-Transfer-Encoding: quoted-printable ..rest of mail iVBORw0KGgoAAAANSUhEUgAAA7QAAAEdCAYAAAA8SyuhAABDQElEQVR42u2deXBU .......
Could you help me to figure out what's wrong here ?
I have raised this issue in Oracle forum but was told that it is OUTLOOK2010 changed the output of my HTML to its own standard. So could you please provide me an acceptable HTML format ( for embedding png image ) ??
- Edited by Sus369 Monday, September 09, 2013 3:43 AM
- use " img src" tag to specify the reference to the image file in the email HTML body, BUT user cannot see the image if they don't have permission to the file folder.
Can anyone help to answer the above question. Let me rephrase here.
I opened Outlook and click on Insert - Picture ( called test.png) and then sent the email ( with inline image) successfully, below is the source code for the email and the most impoartant bit is
So my question is, if I construct the text like below using the Oracle program, would I get the same email via Outlook ? How does the id get generated ? and cid ?
Thanks for your advice.
<body lang="EN-AU" link="blue" vlink="purple"> <div> <p> </p> <p> </p> <p><span ><img width="947" height="474" id="Picture_x0020_1" src="cid:image002.png@01CEAED5.7AD26940"></span></p> </div> <br> <hr> <font face="Arial" color="Gray" size="1"><br> IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.<br> </font> </body> </html>
First please note, since Outlook 2007, Outlook opens the HTML Email and converts it to Microsoft Word format before displaying it to the user. What happens during this process is that many CSS attributes and HTML support is completely removed. Some of the most notable absences are background-image, and padding and margin support.
We may insert HTML into an Email from an existing HTML file by the following steps:
Insert-> (Attach) File-> select the created htm-file-> press the down arrow on the Insert button-> Insert as Text.
I edited your code and tested on my end, that could be successful.
Here is the example:
Thanks Melon for your reply.
I followed your suggestion about "insert HTML into an Email from an existing HTML file"
In Outlook2010 ( Version 14.0.4760.1000) 's email body, I only see the text "Test HTML with Embedded Image 1720", after that, I still see a small red x icon. After I extended its size, it showed "This image cannot currently be displayed". I was using the HTML file with img src="data:image/png;base64
Now the issue seems to relate to Outlook2010 reading inline image file. Could you please let me know the content of the HTML file that was working for you? basically I would like to produce the exact same image in my Outlook first. That is my first step. I think the source of your HTML file must be different to mine ( apart from tbe image data ).
Then I would like to produce a Outlook acceptable HTML file automatically using Oracle PL/SQL. Would Outlook2010 discard that file?
- Edited by Sus369 Wednesday, September 11, 2013 11:53 PM
Could you please reply my question below ?
I am still unable to reproduce what you have done.
Here is what I did :
I chose this web page and clicked on View Source to get the entire code ( including the above pieces) then saved the code to HTML file called test_micorsoft.html. When I opened it with Internet Explorer8 (Version:8.0.7600.16385). I could not see any images but HTML code.
Can you tell me what's wrong here ? A complete, small web page ( .html file) that is working for you would be a good candidate for me to test on my side. It is nothing to do with the image data, it is the layout/header definition I guess.
The source of my HTML file is basically the same as yours.
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Test HTML with Embedded Image</title>
<h1>Test HTML with Embedded Image 1720</h1>
<p>And here it is:</p>
<img src="https://************.jpg?psid=1" width="430">
I edited the image source for security reason.
Please try to insert your html file into a new email, if it displays just like it does in IE, then it's probably not an Outlook issue.
TechNet Community Support
- Edited by Melon ChenMicrosoft contingent staff, Moderator Sunday, September 15, 2013 2:58 PM modify
As I mensioned in my initial email, it worked for me if I use <img src="X:...> when I pointed out the file's physical location but not NOT worked for me if I used<img src="data:image/png;base64 to embed the image data within the EMAIL body ( in Outlook )
These are two different methods. Method 1 worked for me. Method 2 didn't. The disadvantage of Method 1 is that we have to rely on the file access permisson and its network availability. But using Method 2, I could attach the image data on the fly and send to our business users and the email is self contained.
Could you please try to use the method2 and see if we could embed an HTML image file DATA ? If yes, please let me know the content of the specified HTML.
- Edited by Sus369 Sunday, September 15, 2013 11:56 PM