Recommend This Page Using JMail

To create this script, we need the following:

  • Two pages that include scripts
  • An e-mail component that can be used on an NT Server with IIS 3.0 and up, or Personal Web Server 4.0. To send the link in this example, we will use the W3 Jmail component.

In order for us to know what page the user is trying to recommend, we will put a link on that page that points to recommend.asp (the file used in this example). On recommend.asp, we use the following portion of the script:

<% Request.ServerVariables("HTTP_REFFERRER") %>

The Request.ServerVariables("HTTP_REFFERRER") only does one thing: It requests the URL of the page containing the link used to get to recommend.asp.

recomend.asp


<% Dim link
 link = Request.ServerVariables("HTTP_REFFERRER") %>

 Please enter your e-mail address, your friend's e-mail address,
 name, plus subject and message in the text boxes below.<br><br>

<form method="post"action="sendlink.asp">
 Your Name: <inputtype=text name=email><br>
 Friend's e-mail: <inputtype="text"name="recipient"><br>
<input type="text"name="subject"><br>
<input type="textarea name="body"
value="Hereis an articleI saw andthought you mightbe interested init.
There it is:<%=link%>.">
<input type="Submit"value="Submit">

sendlink.asp


<%
'sendlink.asp
 Name   = Request.Form("name")
 SenderEmail = Request.Form("email")
 Subject   = "Regarding " & Request.Form("subject")
 Recipient = Request.Form("recipient")
 Body   = Request.Form("body")

Set JMail = Server.CreateObject("JMail.SMTPMail")

 'Below you should enter your own SMTP-server
 JMail.ServerAddress = "xxx.zzz.yyy"

 JMail.Sender = Senderemail
 JMail.Subject = Subject
 JMail.AddRecipient Recipient
 JMail.Body = Body
 JMail.Priority = 3
 JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")

 JMail.Execute

%>

The page you recommended has been sent to <%= Recipient %> with your message.
<br />Thank you very much.


JMail ASP Recommend This Page


Back To Top
© 1998 - 2024 psacake.com
Version 7.21 | Advertise on this site