Open OUTLOOK without an especific "to:" adress and a HTML code in the body. Javascript or ASP.NET

I want to send a mail with a HTML code to any of my outlook contacts (groups) from a (vbscript) asp.net - javascript application. I don't care if the HTML is in the body or attached.
I used CDONTS but the problem is that i can't choose my outlook contacts.
I try mailto:something@mail.com?body=something but the problem here is that i can't send a long HTML code string, querystring limit.
Please !!! I need help !!!
LVL 1
antonio1313Asked:
Who is Participating?
 
antonio1313Connect With a Mentor Author Commented:
Great !! I know this is not the right way ... but it's the client way.
Thank u !!
I don't use exactly what you say but you help me to find the solution. The code I post is what I used. With this code I don't need to select "Prompt" ... only "Ask" in the IE configuration.

function openMail() {
	try {
		var objApp = new ActiveXObject("Outlook.Application");
		var objNS = objApp.GetNamespace("MAPI");
		
		var theMailItem = objApp.CreateItem(0) 
		theMailItem.Subject = ('<%= subject %>');
		theMailItem.HTMLBody = ('<%= strHTML %>');
		theMailItem.display(0);
	}
	catch(e) {
		alert("An error message")
	}
}

Open in new window

0
 
Louis01Connect With a Mentor Commented:
Accessing a client's outlook data from a web page is something that would probably never work well.
1 Any browser would prevent you from running activex unless explicit permission is granted (In IE's , Internet Options , go to the Security tab -> from Custom Level go to Initialize and script ActiveX controls not marked as safe for scripting and select Prompt)
2 Outlook will try and prevent external objects to get access to it's data.
3 Not all clients use outlook
The list goes on...

var Const_olFolderContacts = 10;
var objApp = new ActiveXObject(Outlook.Application);
var objNS = objApp.GetNamespace(MAPI);
var colContacts = objNS.GetDefaultFolder(Const_olFolderContacts).Items
for( var i=1; i<=colContacts.count;i++)
{
 var v = colContacts.item(i);
 alert(v["FullName"]+ (+v["Email1Address"]+));
}

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.