- ASP - Miscellaneous
·Script Writers
·Database Display
·Response Objects
·Server Variables
·Random Events
·What's New?
Mail List


Mail A Link
Enabling people to mail the link of the current page is an incredibly useful feature to incorporate into your site. People can easily share items viewed with others and mail items without the need for an internet capable email account and bring users back to your site for a second view. There are many ways that this can be accomplished. The following is probably one of the easiest to incorporate. On each page you will need to provide a link or input button that will link to the mail application. When clicked, the referring page url will always be available to display as request.servervariables(“http_referer”). However, mailing a link without knowing much about its contents does not do much. So, by utilizing some simple JavaScript the title of the page can easily be passed and incorporated into the email message. This example demonstrates the use of CDONTS for mailing your info, but has been commented out to prevent overuse and abuse of the mail server. You may also want to include a note on you page detailing that mail addresses are not collected to let people feel secure that their info is not being gathered in your application.
View the Output
Text View
Print View
Mail this Link
Download the Code

<title>Mail A Link Example</title>
<body bgcolor="#FFFFFF">
<!-- Either of the following should be placed on the page(s)
you like to have the mail a link featured on -->
<form action="mailalink.asp" method="post">
Mail A Link Form Example<br>
<script language=JavaScript>
var title = "<input type='hidden' name='title' value='" + document.title + "'>"
document.write (title)
<input type="submit" value="Mail This Link">


Mail A Link Hyperlink Example<br>
<script language=JavaScript>
var title = "<a href='mailalink.asp?title=" + document.title + "'>Mail This Link</a>"
document.write (title)


<body bgcolor="#FFFFFF">
<% ' Grab the title and referring page
if title = "" then 
end if
' u_submitted checks to see if the form with an email address was submitted
if referer = "" then
' If there is no referring page display an appropriate message
response.write "You have reached the Mail-A-Link page, but we were unable to recognize the previous page"
end if ' End check for referer
' If the form with the email address has benn submittes send the mail
if u_submitted <> "Yes" then

<form action="<%= request.servervariables("script_name") %>" method="post">
<b>Subject:</b> <%= title %>
<b>Link:</b> <%= referer %>
Enter the email address of the recipient<br>
<input type="text" name="u_email">
<input type="hidden" name="title" value="<%= title %>">
<input type="hidden" name="referer" value="<%= referer %>">
<input type="hidden" name="u_submitted" value="Yes">
<input type="submit" value="Sumbit">

<% else
body = "The following link was sent to you by a user of" 
body = body & "Subject:" & title 
body = body & "Link:" & referer

' This is the begining of the email creation and execution
' Remove the comments befor each statement that begins with Set or sm
' to actually send the mail message

' Create a new mail object on the server
' set sm = server.CreateObject("CDONTS.Newmail") 

' Declare what address is sending the message
' sm.from = "" 

' Write the users subject to the subject of the email
' sm.Subject = "Requested Link:" & title

' Declare what address the message is being sent to
' The Addressee is set to the inputted value
' = u_email

' Write the users message to the body of the email
' sm.body = u_body 

' Send the message
' sm.Send 

' Clean up the server object
' set sm = nothing 

Your mail has been sent
<% end if 'end check for submission with an email address %>




ASP: What's New? | Articles | Script Writers | Database Display | Read/Write
Server Variables | Response Objects | Random Events | Miscellaneous
HTML: Forms | Hyperlinks | Headers | Tables | Hyperlinks | Headers | Text Display
JavaScript: Document Info | Forms | Images | Navigation | Script Writers
CSS: Basics | Page Display | Text Display | Script Writers | Miscellaneous
  • 2014 michael kors
  • air max women 2013
  • 2014 michael kors
  • air max 2014
  • oakley glasses
  • oakley glasses

  • Maps: Map Script Writers | Bing Maps | Google Maps
  • bottes fr
  • ugg boot
  • Privacy Statement is hosted by
    Donate Food Online with a Mouse Click at
    Donate Land Online with a Mouse Click at
    © 1999 - 2019
    All Rights Reserved

  • Kids jordan 6 rings
  • Jordan retro 10
  • Jordan retro 3