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:bob@bobware.com&Cc=fred@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
[quoted text, click to view] "charmis" <charmis@hotmail.com> wrote in message
news:#SrcTTt#EHA.1188@tk2msftngp13.phx.gbl...
> Hi Rayomond,
>
> Pls check the link
>
http://www.outlookcode.com/d/code/formonweb.htm >
> regards
> charmis
>
>
> "Raymond Du" <rdrd@yahoo.com> wrote in message
> news:%23TSO35s%23EHA.608@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
> >
> >
>
>