To create this script, we need the following:
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.
<% 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 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.