PDA

View Full Version : Use JavaScript to Output HTML to Outlook Compose Window



probey20
Mar 30th, 2007, 02:46 PM
I am creating an interface for business users to customize and create HTML emails to send out. Previously I would create the HTML page and they would open it up in the browser, hit Ctrl+C, and paste it into an Outlook compose window in HTML format.

Now I'm wondering if I can send the generated HTML source code to the compose window for them. I tried using the function below to create a mailto link, but the HTML tags are displaying in the email body rather than rendering correctly. Any ideas what I'm doing wrong? One thing to note is that the emails will be sent to internal users, and we are all using Microsoft Office 2003.


function openComposeWindow()
{
var eMailTo = "[email protected]";
var eSubject = "Email Test";
var eBody = "<html><body><table><tr><td>testing an html email</td></tr></table></body></html>";
var emailLink = '<a href="mailto:' + eMailTo + '?subject=' + eSubject + '&body=' + eBody + '">Email Test</a>';
document.write(emailLink);
}

Thanks!