Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Hyperlink to email in asp.net

Reply
Thread Tools

Hyperlink to email in asp.net

 
 
Steve Chatham
Guest
Posts: n/a
 
      02-09-2004
This ought to be simple, but I've not been able to figure out how to do
this.

I have a request to create a list from a sql database to be displayed in a
datagrid on an asp web page.

So far, so good.

What I now want to do is one of 2 things:

1. put a hyperlink at the bottom of the list, either in the footer or just
below it, saying "Click here to email Mr. X about opportunity pricing". and
what I'd want the hyperlink to do is create an email with the mailto (and a
cc and a subject already filled in.

An alternative:
2. add a column to the datagrid, that would have similar info in it, but in
this case, I'd like to grab the SKU number from the cell on that same row.
The email would come up to Mr X, a cc: to Mr. Y and the Subject would be
Opportunity Pricing - Item ABC" the next line would be similar, but it'd be
ITEM DEF or whatever.

Anyone have an idea as to how to do something that seems to be this simple?

Maybe I need some more caffeine....

Thanks,

SC



 
Reply With Quote
 
 
 
 
Jim Cheshire [MSFT]
Guest
Posts: n/a
 
      02-09-2004
Steve,

Instead of using the MAPI capabilities of your Web browser, I would
recommend that you use System.Web.Mail and the MailMessage class to send
the e-mail. You can then specify who the mail is from, who it should go
to, what the subject should be, what is contained within the body, etc.
That way, the user doesn't have to see the mail message and then click
Send. It just goes.

If that's what you want to do, respond back with the language you are using
and I'll write you a small sample.

Jim Cheshire, MCSE, MCSD [MSFT]
ASP.NET
Developer Support
http://www.velocityreviews.com/forums/(E-Mail Removed)

This post is provided as-is with no warranties and confers no rights.


--------------------
>Reply-To: "Steve Chatham" <(E-Mail Removed)>
>From: "Steve Chatham" <(E-Mail Removed)>
>Subject: Hyperlink to email in asp.net
>Date: Mon, 9 Feb 2004 10:42:24 -0500
>Lines: 32
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
>Message-ID: <(E-Mail Removed)>
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>NNTP-Posting-Host: 12.4.146.123
>Path:

cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTN GP08.phx.gbl!tk2msftngp13.
phx.gbl
>Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:208580
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>
>This ought to be simple, but I've not been able to figure out how to do
>this.
>
>I have a request to create a list from a sql database to be displayed in a
>datagrid on an asp web page.
>
>So far, so good.
>
>What I now want to do is one of 2 things:
>
>1. put a hyperlink at the bottom of the list, either in the footer or just
>below it, saying "Click here to email Mr. X about opportunity pricing". and
>what I'd want the hyperlink to do is create an email with the mailto (and a
>cc and a subject already filled in.
>
>An alternative:
>2. add a column to the datagrid, that would have similar info in it, but

in
>this case, I'd like to grab the SKU number from the cell on that same row.
>The email would come up to Mr X, a cc: to Mr. Y and the Subject would be
>Opportunity Pricing - Item ABC" the next line would be similar, but it'd

be
>ITEM DEF or whatever.
>
>Anyone have an idea as to how to do something that seems to be this simple?
>
>Maybe I need some more caffeine....
>
>Thanks,
>
>SC
>
>
>
>


 
Reply With Quote
 
 
 
 
=?Utf-8?B?VHUtVGhhY2g=?=
Guest
Posts: n/a
 
      02-09-2004
&lt;a href="mailto(E-Mail Removed)?Subject=Your Subject"&gt;Click here to ...&lt;/a&gt

Tu-Thac

----- Steve Chatham wrote: ----

This ought to be simple, but I've not been able to figure out how to d
this

I have a request to create a list from a sql database to be displayed in
datagrid on an asp web page

So far, so good

What I now want to do is one of 2 things

1. put a hyperlink at the bottom of the list, either in the footer or jus
below it, saying "Click here to email Mr. X about opportunity pricing". an
what I'd want the hyperlink to do is create an email with the mailto (and
cc and a subject already filled in

An alternative
2. add a column to the datagrid, that would have similar info in it, but i
this case, I'd like to grab the SKU number from the cell on that same row
The email would come up to Mr X, a cc: to Mr. Y and the Subject would b
Opportunity Pricing - Item ABC" the next line would be similar, but it'd b
ITEM DEF or whatever

Anyone have an idea as to how to do something that seems to be this simple

Maybe I need some more caffeine...

Thanks

S




 
Reply With Quote
 
Steve Chatham
Guest
Posts: n/a
 
      02-09-2004
James - tried to respond via email, but it bounced.

I am writing in vb.

Not 100% sure I will end up doing it your way, but I am interested in seeing
how to do it, as there may be an opportunity to do another piece
differently.

Steve

"Jim Cheshire [MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Steve,
>
> Instead of using the MAPI capabilities of your Web browser, I would
> recommend that you use System.Web.Mail and the MailMessage class to send
> the e-mail. You can then specify who the mail is from, who it should go
> to, what the subject should be, what is contained within the body, etc.
> That way, the user doesn't have to see the mail message and then click
> Send. It just goes.
>
> If that's what you want to do, respond back with the language you are

using
> and I'll write you a small sample.
>
> Jim Cheshire, MCSE, MCSD [MSFT]
> ASP.NET
> Developer Support
> (E-Mail Removed)
>
> This post is provided as-is with no warranties and confers no rights.
>
>
> --------------------
> >Reply-To: "Steve Chatham" <(E-Mail Removed)>
> >From: "Steve Chatham" <(E-Mail Removed)>
> >Subject: Hyperlink to email in asp.net
> >Date: Mon, 9 Feb 2004 10:42:24 -0500
> >Lines: 32
> >X-Priority: 3
> >X-MSMail-Priority: Normal
> >X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
> >Message-ID: <(E-Mail Removed)>
> >Newsgroups: microsoft.public.dotnet.framework.aspnet
> >NNTP-Posting-Host: 12.4.146.123
> >Path:

>

cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTN GP08.phx.gbl!tk2msftngp13.
> phx.gbl
> >Xref: cpmsftngxa07.phx.gbl

microsoft.public.dotnet.framework.aspnet:208580
> >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
> >
> >This ought to be simple, but I've not been able to figure out how to do
> >this.
> >
> >I have a request to create a list from a sql database to be displayed in

a
> >datagrid on an asp web page.
> >
> >So far, so good.
> >
> >What I now want to do is one of 2 things:
> >
> >1. put a hyperlink at the bottom of the list, either in the footer or

just
> >below it, saying "Click here to email Mr. X about opportunity pricing".

and
> >what I'd want the hyperlink to do is create an email with the mailto (and

a
> >cc and a subject already filled in.
> >
> >An alternative:
> >2. add a column to the datagrid, that would have similar info in it, but

> in
> >this case, I'd like to grab the SKU number from the cell on that same

row.
> >The email would come up to Mr X, a cc: to Mr. Y and the Subject would be
> >Opportunity Pricing - Item ABC" the next line would be similar, but it'd

> be
> >ITEM DEF or whatever.
> >
> >Anyone have an idea as to how to do something that seems to be this

simple?
> >
> >Maybe I need some more caffeine....
> >
> >Thanks,
> >
> >SC
> >
> >
> >
> >

>



 
Reply With Quote
 
Jim Cheshire [MSFT]
Guest
Posts: n/a
 
      02-09-2004
Steve,

If you want to send the mail from the server using VB.NET, you would do
this:

Private Function SendEmail() As Boolean
Dim sb As New StringBuilder("")
Dim message As New MailMessage
Dim boolSendSuccessful As Boolean

boolSendSuccessful = True

With sb
.Append("This is my message." + vbCrLf)
.Append("This is another line." + vbCrLf)
End With

With message
.To = "(E-Mail Removed)"
.From = "(E-Mail Removed)"
.Subject = "Auto-Sent E-Mail"
.Body = sb.ToString()
End With

Try
SmtpMail.SmtpServer = "mail.mydomain.com"
SmtpMail.Send(message)
Catch e As Exception
' Do something to handle the exception...
boolSendSuccessful = False
End Try

Return boolSendSuccessful

End Function


Jim Cheshire, MCSE, MCSD [MSFT]
ASP.NET
Developer Support
(E-Mail Removed)

This post is provided as-is with no warranties and confers no rights.

--------------------
>Reply-To: "Steve Chatham" <(E-Mail Removed)>
>From: "Steve Chatham" <(E-Mail Removed)>
>References: <(E-Mail Removed)>

<(E-Mail Removed)>
>Subject: Re: Hyperlink to email in asp.net
>Date: Mon, 9 Feb 2004 11:38:41 -0500
>Lines: 98
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
>Message-ID: <(E-Mail Removed)>
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>NNTP-Posting-Host: 12.4.146.123
>Path:

cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTN GP08.phx.gbl!tk2msftngp13.
phx.gbl
>Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:208606
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>
>James - tried to respond via email, but it bounced.
>
>I am writing in vb.
>
>Not 100% sure I will end up doing it your way, but I am interested in

seeing
>how to do it, as there may be an opportunity to do another piece
>differently.
>
>Steve
>
>"Jim Cheshire [MSFT]" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed)...
>> Steve,
>>
>> Instead of using the MAPI capabilities of your Web browser, I would
>> recommend that you use System.Web.Mail and the MailMessage class to send
>> the e-mail. You can then specify who the mail is from, who it should go
>> to, what the subject should be, what is contained within the body, etc.
>> That way, the user doesn't have to see the mail message and then click
>> Send. It just goes.
>>
>> If that's what you want to do, respond back with the language you are

>using
>> and I'll write you a small sample.
>>
>> Jim Cheshire, MCSE, MCSD [MSFT]
>> ASP.NET
>> Developer Support
>> (E-Mail Removed)
>>
>> This post is provided as-is with no warranties and confers no rights.
>>
>>
>> --------------------
>> >Reply-To: "Steve Chatham" <(E-Mail Removed)>
>> >From: "Steve Chatham" <(E-Mail Removed)>
>> >Subject: Hyperlink to email in asp.net
>> >Date: Mon, 9 Feb 2004 10:42:24 -0500
>> >Lines: 32
>> >X-Priority: 3
>> >X-MSMail-Priority: Normal
>> >X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
>> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
>> >Message-ID: <(E-Mail Removed)>
>> >Newsgroups: microsoft.public.dotnet.framework.aspnet
>> >NNTP-Posting-Host: 12.4.146.123
>> >Path:

>>

>cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFT NGP08.phx.gbl!tk2msftngp13

 
Reply With Quote
 
Steve Chatham
Guest
Posts: n/a
 
      02-09-2004
How would you pick up the .from part for the specific users who are viewing
the results?

For instance, this would be used by both some of our salesreps as well as
some customers. The users are all authenticated using NT Challenge
response.

I can hard code the TO: part of it, because that's always going to the same
person.

Also, is there a way they can edit the body of the message?

SC

"Jim Cheshire [MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Steve,
>
> If you want to send the mail from the server using VB.NET, you would do
> this:
>
> Private Function SendEmail() As Boolean
> Dim sb As New StringBuilder("")
> Dim message As New MailMessage
> Dim boolSendSuccessful As Boolean
>
> boolSendSuccessful = True
>
> With sb
> .Append("This is my message." + vbCrLf)
> .Append("This is another line." + vbCrLf)
> End With
>
> With message
> .To = "(E-Mail Removed)"
> .From = "(E-Mail Removed)"
> .Subject = "Auto-Sent E-Mail"
> .Body = sb.ToString()
> End With
>
> Try
> SmtpMail.SmtpServer = "mail.mydomain.com"
> SmtpMail.Send(message)
> Catch e As Exception
> ' Do something to handle the exception...
> boolSendSuccessful = False
> End Try
>
> Return boolSendSuccessful
>
> End Function
>
>
> Jim Cheshire, MCSE, MCSD [MSFT]
> ASP.NET
> Developer Support
> (E-Mail Removed)
>
> This post is provided as-is with no warranties and confers no rights.
>
> --------------------
> >Reply-To: "Steve Chatham" <(E-Mail Removed)>
> >From: "Steve Chatham" <(E-Mail Removed)>
> >References: <(E-Mail Removed)>

> <(E-Mail Removed)>
> >Subject: Re: Hyperlink to email in asp.net
> >Date: Mon, 9 Feb 2004 11:38:41 -0500
> >Lines: 98
> >X-Priority: 3
> >X-MSMail-Priority: Normal
> >X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
> >Message-ID: <(E-Mail Removed)>
> >Newsgroups: microsoft.public.dotnet.framework.aspnet
> >NNTP-Posting-Host: 12.4.146.123
> >Path:

>

cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTN GP08.phx.gbl!tk2msftngp13.
> phx.gbl
> >Xref: cpmsftngxa07.phx.gbl

microsoft.public.dotnet.framework.aspnet:208606
> >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
> >
> >James - tried to respond via email, but it bounced.
> >
> >I am writing in vb.
> >
> >Not 100% sure I will end up doing it your way, but I am interested in

> seeing
> >how to do it, as there may be an opportunity to do another piece
> >differently.
> >
> >Steve
> >
> >"Jim Cheshire [MSFT]" <(E-Mail Removed)> wrote in message
> >news:(E-Mail Removed)...
> >> Steve,
> >>
> >> Instead of using the MAPI capabilities of your Web browser, I would
> >> recommend that you use System.Web.Mail and the MailMessage class to

send
> >> the e-mail. You can then specify who the mail is from, who it should

go
> >> to, what the subject should be, what is contained within the body, etc.
> >> That way, the user doesn't have to see the mail message and then click
> >> Send. It just goes.
> >>
> >> If that's what you want to do, respond back with the language you are

> >using
> >> and I'll write you a small sample.
> >>
> >> Jim Cheshire, MCSE, MCSD [MSFT]
> >> ASP.NET
> >> Developer Support
> >> (E-Mail Removed)
> >>
> >> This post is provided as-is with no warranties and confers no rights.
> >>
> >>
> >> --------------------
> >> >Reply-To: "Steve Chatham" <(E-Mail Removed)>
> >> >From: "Steve Chatham" <(E-Mail Removed)>
> >> >Subject: Hyperlink to email in asp.net
> >> >Date: Mon, 9 Feb 2004 10:42:24 -0500
> >> >Lines: 32
> >> >X-Priority: 3
> >> >X-MSMail-Priority: Normal
> >> >X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
> >> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
> >> >Message-ID: <(E-Mail Removed)>
> >> >Newsgroups: microsoft.public.dotnet.framework.aspnet
> >> >NNTP-Posting-Host: 12.4.146.123
> >> >Path:
> >>

>
>cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFT NGP08.phx.gbl!tk2msftngp13



 
Reply With Quote
 
Jim Cheshire [MSFT]
Guest
Posts: n/a
 
      02-11-2004
Steve,

You would need to provide a way for your users to input their e-mail
address to populate the From property.

Can they modify the message? Yes. Simply give them a multi-line TextBox
control.

Jim Cheshire, MCSE, MCSD [MSFT]
ASP.NET
Developer Support
(E-Mail Removed)

This post is provided as-is with no warranties and confers no rights.

--------------------
>Reply-To: "Steve Chatham" <(E-Mail Removed)>
>From: "Steve Chatham" <(E-Mail Removed)>
>References: <(E-Mail Removed)>

<(E-Mail Removed)>
<(E-Mail Removed)>
<(E-Mail Removed)>
>Subject: Re: Hyperlink to email in asp.net
>Date: Mon, 9 Feb 2004 15:14:46 -0500
>Lines: 138
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
>Message-ID: <#$(E-Mail Removed)>
>Newsgroups: microsoft.public.dotnet.framework.aspnet
>NNTP-Posting-Host: 12.4.146.123
>Path:

cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTN GP08.phx.gbl!tk2msftngp13.
phx.gbl
>Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.framework.aspnet:208669
>X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
>
>How would you pick up the .from part for the specific users who are viewing
>the results?
>
>For instance, this would be used by both some of our salesreps as well as
>some customers. The users are all authenticated using NT Challenge
>response.
>
>I can hard code the TO: part of it, because that's always going to the same
>person.
>
>Also, is there a way they can edit the body of the message?
>
>SC
>
>"Jim Cheshire [MSFT]" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed)...
>> Steve,
>>
>> If you want to send the mail from the server using VB.NET, you would do
>> this:
>>
>> Private Function SendEmail() As Boolean
>> Dim sb As New StringBuilder("")
>> Dim message As New MailMessage
>> Dim boolSendSuccessful As Boolean
>>
>> boolSendSuccessful = True
>>
>> With sb
>> .Append("This is my message." + vbCrLf)
>> .Append("This is another line." + vbCrLf)
>> End With
>>
>> With message
>> .To = "(E-Mail Removed)"
>> .From = "(E-Mail Removed)"
>> .Subject = "Auto-Sent E-Mail"
>> .Body = sb.ToString()
>> End With
>>
>> Try
>> SmtpMail.SmtpServer = "mail.mydomain.com"
>> SmtpMail.Send(message)
>> Catch e As Exception
>> ' Do something to handle the exception...
>> boolSendSuccessful = False
>> End Try
>>
>> Return boolSendSuccessful
>>
>> End Function
>>
>>
>> Jim Cheshire, MCSE, MCSD [MSFT]
>> ASP.NET
>> Developer Support
>> (E-Mail Removed)
>>
>> This post is provided as-is with no warranties and confers no rights.
>>
>> --------------------
>> >Reply-To: "Steve Chatham" <(E-Mail Removed)>
>> >From: "Steve Chatham" <(E-Mail Removed)>
>> >References: <(E-Mail Removed)>

>> <(E-Mail Removed)>
>> >Subject: Re: Hyperlink to email in asp.net
>> >Date: Mon, 9 Feb 2004 11:38:41 -0500
>> >Lines: 98
>> >X-Priority: 3
>> >X-MSMail-Priority: Normal
>> >X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
>> >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
>> >Message-ID: <(E-Mail Removed)>
>> >Newsgroups: microsoft.public.dotnet.framework.aspnet
>> >NNTP-Posting-Host: 12.4.146.123
>> >Path:

>>

>cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFT NGP08.phx.gbl!tk2msftngp13

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to add a hyperlink column to asp.net datagrid - where only one value is a hyperlink davetichenor ASP .Net 1 10-30-2006 02:57 PM
How to add a hyperlink column to asp.net datagrid - where only one value is a hyperlink Dave ASP .Net Datagrid Control 0 10-21-2006 07:48 PM
How to hyperlink Email addresses and URLs? Graeme ASP .Net 0 09-05-2004 05:28 AM
Re: Expire Email Hyperlink Craig Deelsnyder ASP .Net 1 07-16-2004 11:05 AM
Dynamically Hyperlink and Event Handler for the Hyperlink ? Ken ASP .Net Datagrid Control 1 08-15-2003 11:38 PM



Advertisments