[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2008-11-05
2
Medium Priority
?
497 Views
Last Modified: 2012-06-27
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 !!!
0
Comment
Question by:antonio1313
2 Comments
 
LVL 11

Assisted Solution

by:Louis01
Louis01 earned 1600 total points
ID: 22892636
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
 
LVL 1

Accepted Solution

by:
antonio1313 earned 0 total points
ID: 22900973
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

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Find out what you should include to make the best professional email signature for your organization.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question