473,473 Members | 2,080 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Hyperlink to email in asp.net

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

Nov 18 '05 #1
6 1770
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
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.
--------------------
Reply-To: "Steve Chatham" <me@privacy.net>
From: "Steve Chatham" <me@privacy.net>
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: <u3**************@tk2msftngp13.phx.gbl>
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.gblXref: 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 inthis 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 beITEM 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


Nov 18 '05 #2
&lt;a href="mailto:xy*@abc.com?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


Nov 18 '05 #3
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]" <ja******@online.microsoft.com> wrote in message
news:Ii**************@cpmsftngxa07.phx.gbl...
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
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.
--------------------
Reply-To: "Steve Chatham" <me@privacy.net>
From: "Steve Chatham" <me@privacy.net>
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: <u3**************@tk2msftngp13.phx.gbl>
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:208580X-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 adatagrid 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 justbelow it, saying "Click here to email Mr. X about opportunity pricing". andwhat I'd want the hyperlink to do is create an email with the mailto (and acc:) 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

Nov 18 '05 #4
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 = "so*****@somewhere.com"
.From = "yo*@yourdomain.com"
.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
ja******@online.microsoft.com

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

--------------------
Reply-To: "Steve Chatham" <me@privacy.net>
From: "Steve Chatham" <me@privacy.net>
References: <u3**************@tk2msftngp13.phx.gbl> <Ii**************@cpmsftngxa07.phx.gbl>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: <eO**************@tk2msftngp13.phx.gbl>
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.gblXref: 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 seeinghow to do it, as there may be an opportunity to do another piece
differently.

Steve

"Jim Cheshire [MSFT]" <ja******@online.microsoft.com> wrote in message
news:Ii**************@cpmsftngxa07.phx.gbl...
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
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.
--------------------
>Reply-To: "Steve Chatham" <me@privacy.net>
>From: "Steve Chatham" <me@privacy.net>
>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: <u3**************@tk2msftngp13.phx.gbl>
>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

Nov 18 '05 #5
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]" <ja******@online.microsoft.com> wrote in message
news:yx**************@cpmsftngxa07.phx.gbl...
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 = "so*****@somewhere.com"
.From = "yo*@yourdomain.com"
.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
ja******@online.microsoft.com

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

--------------------
Reply-To: "Steve Chatham" <me@privacy.net>
From: "Steve Chatham" <me@privacy.net>
References: <u3**************@tk2msftngp13.phx.gbl> <Ii**************@cpmsftngxa07.phx.gbl>
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: <eO**************@tk2msftngp13.phx.gbl>
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:208606X-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]" <ja******@online.microsoft.com> wrote in message
news:Ii**************@cpmsftngxa07.phx.gbl...
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
ja******@online.microsoft.com

This post is provided as-is with no warranties and confers no rights.
--------------------
>Reply-To: "Steve Chatham" <me@privacy.net>
>From: "Steve Chatham" <me@privacy.net>
>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: <u3**************@tk2msftngp13.phx.gbl>
>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

Nov 18 '05 #6
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
ja******@online.microsoft.com

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

--------------------
Reply-To: "Steve Chatham" <me@privacy.net>
From: "Steve Chatham" <me@privacy.net>
References: <u3**************@tk2msftngp13.phx.gbl> <Ii**************@cpmsftngxa07.phx.gbl>
<eO**************@tk2msftngp13.phx.gbl>
<yx**************@cpmsftngxa07.phx.gbl>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: <#$**************@tk2msftngp13.phx.gbl>
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.gblXref: 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]" <ja******@online.microsoft.com> wrote in message
news:yx**************@cpmsftngxa07.phx.gbl...
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 = "so*****@somewhere.com"
.From = "yo*@yourdomain.com"
.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
ja******@online.microsoft.com

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

--------------------
>Reply-To: "Steve Chatham" <me@privacy.net>
>From: "Steve Chatham" <me@privacy.net>
>References: <u3**************@tk2msftngp13.phx.gbl>

<Ii**************@cpmsftngxa07.phx.gbl>
>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: <eO**************@tk2msftngp13.phx.gbl>
>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

Nov 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Nel | last post by:
I am trying to write a content management section for a web site. I have managed so far to use htmlarea to give users a basic, but user friendly interface by which to edit the page content. ...
4
by: Tero Partanen | last post by:
Hello! I'm writing about a rather peculiar problem I'm having with Access2000. I have a table in which I have created one hyperlink-type field. I have given the field a default value which is...
3
by: Tim::.. | last post by:
I currently have the following datagrid but want to turn the name and email column into a hyperlink in the codebehind! Can someone please tell me how I achieve this! Thanks Private Sub...
1
by: Nathan Sokalski | last post by:
I am using the ImageUrl property of the Hyperlink control to create a graphical Hyperlink. However, I want to change the size of the image I am using, but the generated HTML places the width/height...
5
by: Patrick.O.Ige | last post by:
I want to have a rollover image on an hyperlink inside a Repeater control but when i run the page i get "Image1 is undefined" Any ideas? I have a Hyperlink and an Image control in a repeater...
8
by: Nathan Sokalski | last post by:
I have several System.Web.UI.WebControls.HyperLink Controls which I want to display as rollover images. I know how to make these manually using the <a> and <img> tags or the <a> tag and a...
3
by: mcse4u | last post by:
I would like to be able to add a hyperlink to the posted form below that automatically creates a hyperlink of the email address of the person submitting the form. Can someone please help me with...
1
by: jodyblau | last post by:
I have noticed that if you right click on a hyperlink field and edit the hyperlink, you can set it to be an email address and open up Outlook when it is clicked. I have been trying to set this...
20
by: tshad | last post by:
I had posted this problem earlier and just noticed that the Hyperlink is the problem. Apparently, it doesn't figure out the path correctly. It uses the path of the file it is in, even if it is...
3
by: Nathan Sokalski | last post by:
I am using the ImageUrl property of the HyperLink control. My image is large, so I am setting the width/height attributes, but when it renders the width/height attributes are in the <atag rather...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.