Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 ASP.NET 2.0 button click to perform 2 actions

Author  Topic 

bubberz
Constraint Violating Yak Guru

289 Posts

Posted - 2007-02-14 : 12:22:56
I have a button click and what I need to do is too things:

1. Send an email to the value of what was selected from a required dropdown list of people

2. Then send the user to another page.

I wanted to do both of these in the code behind, and it's been decided the application owner (person who's funding the application) would like to use the client's email application (ie. Eudora, Outlook, etc.) when sending this email.

I'm not sure how to replicate the href='mailto:person@person.com' that's possible with the anchor tag.

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-02-14 : 12:43:27
this is kind of interesting.
i think you should use javascript's location.href on pageload on the postback.
that's the only way i can think that this would even remotely work...



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-02-14 : 13:04:25
you need to do this server side, unless you are not explaining step #1 clearly or I am misunderstanding.

You cannot actually send an email using a webpage at the client (I hope!!!) --it would be a huge security hole if that was allowed! All you can do is provide a link that will open up a new message in their email client, if they have one, using a mailto: link. There would be now way to automatically actually compose and *send* the email. thank goodness for that.

Also, of course, many users don't have email client configured properly to do this anyway, so what happens then?



- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

jhermiz

3564 Posts

Posted - 2007-02-15 : 10:05:51
quote:
Originally posted by jsmith8858

you need to do this server side, unless you are not explaining step #1 clearly or I am misunderstanding.

You cannot actually send an email using a webpage at the client (I hope!!!) --it would be a huge security hole if that was allowed! All you can do is provide a link that will open up a new message in their email client, if they have one, using a mailto: link. There would be now way to automatically actually compose and *send* the email. thank goodness for that.

Also, of course, many users don't have email client configured properly to do this anyway, so what happens then?



- Jeff
http://weblogs.sqlteam.com/JeffS




You can still do this using activex. The client must accept a certificate to proceed however. For instance, I was able to actually write a web application that uses outlook to send outlook tasks.


Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]

RS Blog -- [url]http://weblogs.sqlteam.com/jhermiz[/url]
Go to Top of Page

jhermiz

3564 Posts

Posted - 2007-02-15 : 10:07:06
quote:
Originally posted by jhermiz

quote:
Originally posted by jsmith8858

you need to do this server side, unless you are not explaining step #1 clearly or I am misunderstanding.

You cannot actually send an email using a webpage at the client (I hope!!!) --it would be a huge security hole if that was allowed! All you can do is provide a link that will open up a new message in their email client, if they have one, using a mailto: link. There would be now way to automatically actually compose and *send* the email. thank goodness for that.

Also, of course, many users don't have email client configured properly to do this anyway, so what happens then?



- Jeff
http://weblogs.sqlteam.com/JeffS




You can still do this using activex. The client must accept a certificate to proceed however. For instance, I was able to actually write a web application that uses outlook to send outlook tasks.


Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]

RS Blog -- [url]http://weblogs.sqlteam.com/jhermiz[/url]



Just an addition when the action occurs, such as sending an email or task, outlook informs you that "another application is trying to send mail on your behalf, accept or deny". So there still needs to be some action on the client side to perform this operation. Its all ActiveX though.



Keeping the web experience alive -- [url]http://www.web-impulse.com[/url]

RS Blog -- [url]http://weblogs.sqlteam.com/jhermiz[/url]
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-02-15 : 11:07:33
Yes, that is correct, if the user will install activeX controls locally on their machine and accept all the security warnings and such, then indeed you can do whatever you want on the client machine.

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page

bubberz
Constraint Violating Yak Guru

289 Posts

Posted - 2007-02-25 : 23:43:42
Thanks to all who replied!

What we ended up doing was when the user clicked close, and they were taken to the next page, I gave them an option to send the email. Very likely the email can be avoided, so it was decided to give the end user the option to send or not.

Thanks!
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2007-02-26 : 08:12:32
So where is the mail sent from, the client or the server?

- Jeff
http://weblogs.sqlteam.com/JeffS
Go to Top of Page
   

- Advertisement -