By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,214 Members | 2,066 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,214 IT Pros & Developers. It's quick & easy.

Bring up outlook client from ASP.Net

P: n/a
Hi,

I have a ASP.Net button in a webform. What I like to do, if this button is
clicked, the page should connect to a SQL server run some stored procedure,
then bring up user's MS Outlook client and fill in the mail to address,
subject and body using the dataset returned by stored procedure. I know how
to connect to SQL and get dataset back, I don't know how to bring up
Outllook on client side and fill in mailto, subject and body.

BTW, All our user computers are configured to use MS Outlook as default
email agent .

TIA
Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Rayomond,

Pls check the link
http://www.outlookcode.com/d/code/formonweb.htm

regards
charmis
"Raymond Du" <rd**@yahoo.com> wrote in message
news:%2*****************@TK2MSFTNGP15.phx.gbl...
Hi,

I have a ASP.Net button in a webform. What I like to do, if this button is
clicked, the page should connect to a SQL server run some stored
procedure,
then bring up user's MS Outlook client and fill in the mail to address,
subject and body using the dataset returned by stored procedure. I know
how
to connect to SQL and get dataset back, I don't know how to bring up
Outllook on client side and fill in mailto, subject and body.

BTW, All our user computers are configured to use MS Outlook as default
email agent .

TIA

Nov 19 '05 #2

P: n/a
Raymond, if you're just trying to fill in the To/Cc/Subject, there might be
an easier way.

When the user clicks the button, do your database query and construct a
mailto Url, something in the following format;

mailto:[ your To addresses ]&Cc=[ Any Cc addresses ]&Subject=[ The Subject ]

e.g....

mailto:bo*@bobware.com&C******@bobware.com&Subject =Hey how's it going

If you then do a Response.Redirect to this Url, I expect that IE will create
a new mail message using your defailt email client nicely.

The effect should be, user clicks the button and the email form appears...
essentially no other complications.

You will probably need to Server.UrlEncode the actual data that you put in
place of the [bracketed] text, as in;

string szUrl, szToAddresses, szCcAddresses, szSubject;

// do your db query, set the To, Cc, and Subject vars

// create the Url
szUrl = String.Format (
"mailto:{0}&Cc={1}&Subject={2}",
Server.UrlEncode (szToAddresses),
Server.UrlEncode (szCcAddresses),
Server.UrlEncode (szSubject)
);

Trace.Write ("Mailto Url: " + szUrl); // for debugging

// force the browser to process the new Url
Response.Redirect (szUrl);
/// M
"charmis" <ch*****@hotmail.com> wrote in message
news:#S**************@tk2msftngp13.phx.gbl...
Hi Rayomond,

Pls check the link
http://www.outlookcode.com/d/code/formonweb.htm

regards
charmis
"Raymond Du" <rd**@yahoo.com> wrote in message
news:%2*****************@TK2MSFTNGP15.phx.gbl...
Hi,

I have a ASP.Net button in a webform. What I like to do, if this button is clicked, the page should connect to a SQL server run some stored
procedure,
then bring up user's MS Outlook client and fill in the mail to address,
subject and body using the dataset returned by stored procedure. I know
how
to connect to SQL and get dataset back, I don't know how to bring up
Outllook on client side and fill in mailto, subject and body.

BTW, All our user computers are configured to use MS Outlook as default
email agent .

TIA


Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.