473,396 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Inserting a dynamic URL in to a MAILTO: tag

Hello,

I have about 60+ pages that I need to insert a MAILTO: tag so people can
email the page using their email client. The body of the message is
going to be the URL of that page. Using ASP, how can I insert the page
URL in the email body without having to manually enter each URL for each
MAILTO: tag? Is there a variable that can be used inside the MAILTO: tag
that automatically inserts the current page's URL into the body of the
email?

Thank you in advance,

JWA
Nov 19 '05 #1
6 7369
35th Ave Media < na@na.na > wrote:
I have about 60+ pages that I need to insert a MAILTO: tag so people can
email the page using their email client. The body of the message is going
to be the URL of that page. Using ASP, how can I insert the page URL in
the email body without having to manually enter each URL for each MAILTO:
tag? Is there a variable that can be used inside the MAILTO: tag that
automatically inserts the current page's URL into the body of the email?

Check out the Request object - there should be something there you can use,
likely:

HttpContext.Current.Request.Url

There are also some other properties in Request that might work if Url isn't
exactly right. HTH.
Nov 19 '05 #2
I'm not sure if this will work on mail clients other than Outlook (I haven't
tried it) but for some simple tasks, I've just done the following:

<a
href="mailto:ex*****@e-mail.com?subject=Check%20This%20Out!&body=http://www.microsoft.com">E-Mail</a>

Another thing you could do is consider handling the dynamic build of an
e-mail message server side. Your post said ASP and although this is an
ASP.NET news group, I'll post the solutions for both.

ASP.NET
Read up on the classes located in System.Web.Mail paying particular
attention to the SmtpServer and MailMessage classes.
http://msdn.microsoft.com/library/de...temwebmail.asp

ASP
Read up on the CDONTS objects focusing on the NewMail object.
http://msdn.microsoft.com/library/de...ts_library.asp

--
HTH
Dave Fancher
http://davefancher.blogspot.com
"Jeff Evans" <jwevans1@you_eye_you_see.edu> wrote in message
news:Ol**************@TK2MSFTNGP10.phx.gbl...
35th Ave Media < na@na.na > wrote:
I have about 60+ pages that I need to insert a MAILTO: tag so people can
email the page using their email client. The body of the message is going
to be the URL of that page. Using ASP, how can I insert the page URL in
the email body without having to manually enter each URL for each MAILTO:
tag? Is there a variable that can be used inside the MAILTO: tag that
automatically inserts the current page's URL into the body of the email?

Check out the Request object - there should be something there you can
use, likely:

HttpContext.Current.Request.Url

There are also some other properties in Request that might work if Url
isn't exactly right. HTH.

Nov 19 '05 #3
Please forgive my ingnorance of not knowing much more than HTML.

Your reference came in handy. Thank you for the help.

Now another question:
I have two pages: 1) The form page for submitting the form 2) The form
processor page that processes the information from the form and emails
the info.

Example:

1. User clicks link (Email this page)
2. A browser window opens with the form page (formpage.asp) for the
user to fill out their email address etc.
3. User submits form then the data is processed by formpage_process.asp
and the email is created and mailed off to the
recipient.

What I would like to do is have the page TITLE and URL, where the "Email
this page" link is placed, to be inserted into the email body. How do I
transfer the TITLE and URL over the the formpage.asp to be displayed on
the form page AND then have it passed to the formpage_process.asp to be
inserted into the body of the email?

I can work out the part for displaying it in the email body, but I have
no idea how to grab the TITLE and URL and pass it to both pages.

Let me know if I should paste the code I have.

Thank you for your help,

JWA

Dave Fancher wrote:
I'm not sure if this will work on mail clients other than Outlook (I haven't
tried it) but for some simple tasks, I've just done the following:

<a
href="mailto:ex*****@e-mail.com?subject=Check%20This%20Out!&body=http://www.microsoft.com">E-Mail</a>

Another thing you could do is consider handling the dynamic build of an
e-mail message server side. Your post said ASP and although this is an
ASP.NET news group, I'll post the solutions for both.

ASP.NET
Read up on the classes located in System.Web.Mail paying particular
attention to the SmtpServer and MailMessage classes.
http://msdn.microsoft.com/library/de...temwebmail.asp

ASP
Read up on the CDONTS objects focusing on the NewMail object.
http://msdn.microsoft.com/library/de...ts_library.asp

Nov 19 '05 #4
Since you're using traditional ASP I'd recommend posting future questions to
microsoft.public.inetserver.asp (or a similar group) if you haven't done so
already (I didn't look) but we can finish this one here ;)

To get the values to your form, you'll have to put them into the querystring
portion of the link. You'll probably have to define the page title as a
variable so you can use it in both <TITLE> and in your link. The URL will
be a bit easier.

(All code is in JavaScript)

<%
var title = "Page Title";
%>
....
<TITLE><%= title %></TITLE>
....
<A href="formpage.asp?title=<%= title %>&url=<%=
Request.ServerVariables("HTTP_URL") %>">E-Mail This Page</a>

As for retrieving these values on formpage.asp, you'll have to use the
following:
<%
var title = Request.QueryString("title");
var url = Request.QueryString("url");
%>

Depending on how you lay out your form you have a few options:

1.) Title and URL simply displayed in the body of the page.
Just reference the variable <%= title %> or <%= url %>
AND
include hidden fields in the form <input type="hidden" name="title"
value="<%= title %>"> (same concept for URL)

2.) Displayed in text fields.
<input type="text" name="title" value="<%= title %>"> (same concept for URL)

3.) If you're allowing your users to enter a custom body in addition to the
title and URL and you want to include these in the body text box.
<textarea id="msgBody">
<%= title %><%= url %>
</textarea>

When the form is submitted, the field names will be accessible from the
Request.Form collection in formpage_process.asp.
<%
// Include these lines as needed depending on which method you use.
var title = Request.Form("title");
var url = Request.Form("url");
var msgBody = Request.Form("msgBody");

...
// You can then build your message body by concatenating the strings
together.
var mailBody = title + "\n" + url + "\n" + msgBody;
...
%>

HTH
--
Dave Fancher
http://davefancher.blogspot.com
"35th Ave Media" <na@na.na> wrote in message
news:OD**************@TK2MSFTNGP11.phx.gbl...
Please forgive my ingnorance of not knowing much more than HTML.

Your reference came in handy. Thank you for the help.

Now another question:
I have two pages: 1) The form page for submitting the form 2) The form
processor page that processes the information from the form and emails
the info.

Example:

1. User clicks link (Email this page)
2. A browser window opens with the form page (formpage.asp) for the
user to fill out their email address etc.
3. User submits form then the data is processed by formpage_process.asp
and the email is created and mailed off to the
recipient.

What I would like to do is have the page TITLE and URL, where the "Email
this page" link is placed, to be inserted into the email body. How do I
transfer the TITLE and URL over the the formpage.asp to be displayed on
the form page AND then have it passed to the formpage_process.asp to be
inserted into the body of the email?

I can work out the part for displaying it in the email body, but I have no
idea how to grab the TITLE and URL and pass it to both pages.

Let me know if I should paste the code I have.

Thank you for your help,

JWA

Dave Fancher wrote:
I'm not sure if this will work on mail clients other than Outlook (I
haven't tried it) but for some simple tasks, I've just done the
following:

<a
href="mailto:ex*****@e-mail.com?subject=Check%20This%20Out!&body=http://www.microsoft.com">E-Mail</a>

Another thing you could do is consider handling the dynamic build of an
e-mail message server side. Your post said ASP and although this is an
ASP.NET news group, I'll post the solutions for both.

ASP.NET
Read up on the classes located in System.Web.Mail paying particular
attention to the SmtpServer and MailMessage classes.
http://msdn.microsoft.com/library/de...temwebmail.asp

ASP
Read up on the CDONTS objects focusing on the NewMail object.
http://msdn.microsoft.com/library/de...ts_library.asp

Nov 19 '05 #5
Hey Dave,

Thank you for your help. You made my life much easier - not to mention I
learned quite a bit from you example.

James
Dave Fancher wrote:
Since you're using traditional ASP I'd recommend posting future questions to
microsoft.public.inetserver.asp (or a similar group) if you haven't done so
already (I didn't look) but we can finish this one here ;)

To get the values to your form, you'll have to put them into the querystring
portion of the link. You'll probably have to define the page title as a
variable so you can use it in both <TITLE> and in your link. The URL will
be a bit easier.

(All code is in JavaScript)

<%
var title = "Page Title";
%>
...
<TITLE><%= title %></TITLE>
...
<A href="formpage.asp?title=<%= title %>&url=<%=
Request.ServerVariables("HTTP_URL") %>">E-Mail This Page</a>

As for retrieving these values on formpage.asp, you'll have to use the
following:
<%
var title = Request.QueryString("title");
var url = Request.QueryString("url");
%>

Depending on how you lay out your form you have a few options:

1.) Title and URL simply displayed in the body of the page.
Just reference the variable <%= title %> or <%= url %>
AND
include hidden fields in the form <input type="hidden" name="title"
value="<%= title %>"> (same concept for URL)

2.) Displayed in text fields.
<input type="text" name="title" value="<%= title %>"> (same concept for URL)

3.) If you're allowing your users to enter a custom body in addition to the
title and URL and you want to include these in the body text box.
<textarea id="msgBody">
<%= title %><%= url %>
</textarea>

When the form is submitted, the field names will be accessible from the
Request.Form collection in formpage_process.asp.
<%
// Include these lines as needed depending on which method you use.
var title = Request.Form("title");
var url = Request.Form("url");
var msgBody = Request.Form("msgBody");

...
// You can then build your message body by concatenating the strings
together.
var mailBody = title + "\n" + url + "\n" + msgBody;
...
%>

HTH

Nov 19 '05 #6
No problem, glad I could be of service.

--
Dave Fancher
http://davefancher.blogspot.com
"35th Ave Media" <na@na.na> wrote in message
news:u9**************@TK2MSFTNGP12.phx.gbl...
Hey Dave,

Thank you for your help. You made my life much easier - not to mention I
learned quite a bit from you example.

James
Dave Fancher wrote:
Since you're using traditional ASP I'd recommend posting future questions
to microsoft.public.inetserver.asp (or a similar group) if you haven't
done so already (I didn't look) but we can finish this one here ;)

To get the values to your form, you'll have to put them into the
querystring portion of the link. You'll probably have to define the
page title as a variable so you can use it in both <TITLE> and in your
link. The URL will be a bit easier.

(All code is in JavaScript)

<%
var title = "Page Title";
%>
...
<TITLE><%= title %></TITLE>
...
<A href="formpage.asp?title=<%= title %>&url=<%=
Request.ServerVariables("HTTP_URL") %>">E-Mail This Page</a>

As for retrieving these values on formpage.asp, you'll have to use the
following:
<%
var title = Request.QueryString("title");
var url = Request.QueryString("url");
%>

Depending on how you lay out your form you have a few options:

1.) Title and URL simply displayed in the body of the page.
Just reference the variable <%= title %> or <%= url %>
AND
include hidden fields in the form <input type="hidden" name="title"
value="<%= title %>"> (same concept for URL)

2.) Displayed in text fields.
<input type="text" name="title" value="<%= title %>"> (same concept for
URL)

3.) If you're allowing your users to enter a custom body in addition to
the title and URL and you want to include these in the body text box.
<textarea id="msgBody">
<%= title %><%= url %>
</textarea>

When the form is submitted, the field names will be accessible from the
Request.Form collection in formpage_process.asp.
<%
// Include these lines as needed depending on which method you use.
var title = Request.Form("title");
var url = Request.Form("url");
var msgBody = Request.Form("msgBody");

...
// You can then build your message body by concatenating the strings
together.
var mailBody = title + "\n" + url + "\n" + msgBody;
...
%>

HTH

Nov 19 '05 #7

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

Similar topics

4
by: John Pether (john | last post by:
Hi I have a page that displays business listings. I have a repeater with dynamic text and in the 4th column I have an email and website link. Both display properly but I need to have one take...
1
by: CES | last post by:
All, Could someone please look at this and tell me what's wrong... the function works properly in FireFox but in IE onmouseover it replaces the innerHTML. So the original html: at info@test.com...
4
by: jrefactors | last post by:
I want to distinguish between static SQL, dynamic SQL, and embedded SQL, but couldn't find too much useful resources in the web. For example, if we put SQL statements (SELECT, INSERT, UPDATE,...
2
by: collinm | last post by:
hi i expect to find 7 file on a folder... maybe less, maybe more... i can surely put this number to 1... but i think doing some realloc will be expensive... after 7 files, i need to use...
9
by: Zak Milas | last post by:
The field is too small to accept the amount of data you attempted to add. Try inserting or pasting less data. Is the error I get when it get dbCmd.ExecuteNonQuery();. I have 15 fields to insert,...
3
by: sferriol | last post by:
hello is it possible with postgres 7.2 or more, to define a dynamic view. For example, i have a table with a column 'user' and i want to define a view which gives infomrations from different...
2
by: Slain | last post by:
I have a big list of HTML files, which need to be updated with a common text. <script language=JavaScript src="./highlight.js"></script> I need to add the above line in each of the html...
0
by: miamikk | last post by:
I am XML newbie. I have question about inserting dynamic text in the header of HTML table. This is the site I have created (Only Report Type 1 is working)...
0
by: Edwin.Madari | last post by:
-----Original Message----- statement prepared first and executed many times with exectemany - db API http://www.python.org/dev/peps/pep-0249/ inline statemets can be exeucuted only. hope that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
0
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...

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.