0

I am trying to send an email (using Outlook mail) from a jsp page. Requirement is, when the user clicks on send email button the data stored in a string (with HTML tags) should be passed to the mailbody. But the problem is, the text displayed in mail body is not formatted as HTML text.

Could you please suggest how to format it as HTML text in Outlook Doc. I have used the below code in a function-

function OpenOutlookDoc(whatform,msgBody) 
{
outlookApp = new ActiveXObject("Outlook.Application"); 
nameSpace = outlookApp.getNameSpace("MAPI"); 
mailFolder = nameSpace.getDefaultFolder(6); 
mailItem = mailFolder.Items.add(whatform); 
mailItem.Display(0);
mailItem.To = "[email protected]";
mailItem.Subject = "TEST MAIL";
mailItem.Messageclass = whatform;
mailItem.Body = msgBody; //the text here is concatenated with HTML tags
mailItem.Send();
} 

Thanks for you upcoming help..

1
  • 1
    You're question has actually nothing to do with either java or jsp. I suggest add comments tags like activex or outlook. You could look at the msdn or the outlook vba help. As far as I know the api-documentation is an optional component during installation of MS-Office. Commented Jun 15, 2011 at 10:26

2 Answers 2

1

After some google'ing: The MSDN should help: http://msdn.microsoft.com/en-us/library/aa171418%28v=office.11%29.aspx The article includes an example to send html emails using vb-script. Converting that to javascript should not be hard - but since activex only works from within Internet Explorer you might as well use vbscript.

Sign up to request clarification or add additional context in comments.

Comments

0

Try adding message.IsBodyHtml = true; to your code.

otherwise u can refer this example.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.