Email Sas Html Output
Solution 1:
There is one more alternative that DomPazz did not mention and I'll include it here for completeness. I do NOT recommend this approach unless you find yourself in the following situation:
- You are not allowed to use an attachment.
- The only locations you have available to place the images are either on an intranet or HTTPS server.
- The emails have to be readable from smartphones (which usually won't be connected to company VPN or able to supply HTTPS credentials to download and display the images).
Cons
- This method is not supported directly by SAS.
- It requires third party tools (such as BLAT - http://www.blat.net/).
- HTML email messages are known to be pretty finicky when being rendered, so you must keep them simple.
- It's not for the faint of heart.
Overview
The basic premise is that you create your charts as images on disk, create your HTML file on disk, and then use a 3rd party tool to send the email. The third party tool will embed the charts into the email, and the HTML you created will reference the embedded images using what is known as a CID (content-ID).
I suggest doing a little reading/googling on the terms 'html email cid' to become familiar with this first. You may also want to do a little reading up on base64 encoding and mime-types. You don't need to become an expert just learn enough to know what they are and roughly how they work.
Developing/Testing
You can still use ODS to create your .html
file but be sure to use ODS HTML3
which forces SAS to use an older version of HTML. It also forces it to repeat the styling against each element. You need this because email clients such as Outlook actually use the MS Word engine to render HTML emails.
Once you have built your .html file and charts, open the .html file in a web browser and make sure it is displaying correctly.
Once you have your output displaying as desired in your web browser you still have a few more changes you need to make before you can send it as an email. When developing in your browser you would have noticed you embedded the image like this:
<imgsrc="my_image.png" />
Well we can't do that for email, we need to use the CID link like this:
<imgsrc="cid:my_image.png" />
When we use BLAT to send the email, we'll specify the images to embed. The image names will automatically be used for the CID:
naming conventions.
You can send an email using BLAT like so:
blat test.html -f "myemailaddress@myemailaddress.com" -subject "test" -html -alttextf test.html -embed test.png -server mail.mysmtpserver.com -to myrecipient@recipentemail.com
That's about it. Maybe if I get more time I'll provide a full piece of code with a working example.
Some useful reading:
http://24ways.org/2009/rock-solid-html-emails (READ THIS!!)
Solution 2:
The graphs are not showing because they are not available to the html viewer.
Options
You could write the images to a place that is available and ensure the paths in the generated html are correct.
Generate a PDF or RTF file and email that.
Use SVG (scalable vector graphics). This will require you to parse the output files and embed the XML for the SVG into the HTML.
Post a Comment for "Email Sas Html Output"