A notice from the editors: This text, whereas useful in its day, is now outdated.
Ah, sure, the “ship to good friend” service. That fantastic little software that everybody makes use of to construct their group. An internet site is like every other group, in that it’s constructed by phrase of mouth. One good friend tells one other, who tells one other, who tells one other, till your group has begun to develop exponentially.
Article Continues Under
No less than, that’s the way it works in idea. In observe, there’s a slight downside with anticipating your guests to publicize your website.
Customers aren’t employees#section2
Sadly, telling one’s buddies a couple of new website isn’t all the time fast and straightforward. Your guests first have to seek out the location, then determine their buddies really want to learn about it. Subsequent, they need to open their mail app, copy and paste your URL, sprint off a witty remark, and eventually, click on Ship. That’s extra work than many internet customers are keen to do.
Effectively, we’re going to make it simpler in your guests to ask their buddies by reducing out these center steps. With the SEND TO FRIEND kind in place, all guests want do is determine they like your web page, sort a remark, and click on a button.
(In fact, it helps if they really like your web site, however constructing websites that folks like is greater than we will cowl in a tutorial.)
- Primary information of HTML and ASP (and I imply fundamental; we’ll have the complete
app for obtain on the finish) - Familiarity with, and information of the best way to use, HTML kinds
- Capability to repeat and paste
- Entry to a server with ASP and CDOMail
- Capability to create three easy internet pages, two of which should be ASP recordsdata (a hyperlink on the web page you need to ship, one to get the e-mail info, and one to ship the e-mail)
Begin constructing your kind!#section4
The very first thing we have to do is to position a hyperlink on the web page we need to ship. There’s completely nothing particular about this hyperlink. It’s only a common <a href="https://alistapart.com/article/sendtofriend/sendtofriend.asp">
hyperlink. All of the work might be completed on our subsequent web page. This makes it quite simple to combine the Ship To Good friend pages into your present website, as there isn’t any change to your present markup or construction.
Now that our customers have clicked the hyperlink to our Ship To Good friend web page, we want
to construct a kind for them to fill out. This may require 4 kind fields:
Discipline |
Kind |
Worth |
---|---|---|
FromEmail |
TEXT |
Person enter (their deal with) |
ToEmail |
TEXT |
Person enter (their good friend’s deal with) |
Message |
TEXTAREA |
Person enter (their witty remark) |
URL |
HIDDEN |
Right here’s the shape we’re going to make use of to gather this info from our customer:
<kind methodology="put up"> <p>Your Electronic mail: <enter sort="textual content" title="FromEmail"> </p> <p>What's your e mail deal with?: <enter sort="textual content" title="ToEmail"> </p> <p>Your Message: <textarea cols="40" rows="5" title="Message"> </textarea> </p> <p> <enter sort="hidden" title="URL" worth="<%= Request.ServerVariables("HTTP_REFERER")%>"> <enter sort="submit" worth="Ship the Hyperlink!" title="SUBMIT"> <enter sort="reset" worth="Clear" title="RESET"> </kind></p>
Now that we have now our kind constructed, let’s have a look at precisely what we’ve completed. The one factor actually particular about this web page is the hidden kind ingredient named URL. We’ve stuffed this hidden ingredient with the HTTP_REFERRER
server variable that’s constructed into ASP. (Principally, any time you progress from one web page to a different, the URL of the web page you got here from goes into the HTTP_REFERRER
variable.) We additionally set the motion of our kind to the subsequent web page, which can truly ship our e mail.
Now we come to the juicy a part of our utility. After the customer clicks Submit, the shape values might be fed to to a web page entitled ship.asp
. Ship.asp does all of the work for us, together with sending our e mail, giving the customer a affirmation that it’s been completed, and offering her or him with a hyperlink again to the web page the place the entire course of began (the referred web page).
We’ll ship our e mail by way of the next code on the high of our web page; the feedback
will let you know what every part does:
<%@LANGUAGE="VBSCRIPT"%> <% 'Create our e mail object so the server 'is aware of we need to ship a brand new e mail message Dim objCDO Set objCDO = Server.CreateObject("CDONTS.NewMail") 'Set our from and to e mail addresses objCDO.To = Request.Type("ToEmail") objCDO.From = Request.Type("FromEmail")'Ship a BCC to ourselves, so we will inform when individuals are 'utilizing our service, and what they're telling their buddies 'That is additionally a great way to make sure that individuals aren't 'utilizing your service for nefarious functions, similar to spam. objCDO.bcc = "[email protected]"'Create our topic objCDO.Topic = "Try this Ship-To-Good friend Tutorial!"'Create the physique of our message, what our new customer 'will see of their e mail reader. objCDO.Physique = strFrom & " has really useful that you simply try " _ & "this web page at A Listing Aside:" _ & VbCrLf & VbCrLf & Request.Type("URL") _ & VbCrLf & VbCrLf & Request.Type("message") _ & VbCrLf & VbCrLf & VbCrLf _ & "This web page was despatched utilizing our Ship-to-Good friend service." _ & "Your e mail deal with has not been added to any record of any type, " _ & "and has not been recorded at our website."'Lastly, ship our e mail and delete it as soon as we're completed. objCDO.Ship Set objCDO = Nothing %>
I do know what you’re saying: What the heck are all these references to VbCrLf
? These are carriage returns for our e mail, so we will break up our textual content, making it good and clear.
Now that the remark has been mailed, we show a sensible little “copy” of similar, so the customer can see what was despatched; and we offer the customer with a way to get again to the place she or he began. All gadgets in ASP delimiters (<% %>
) might be pulled from what was submitted by the customer.
When you’re having bother creating the pages by yourself, be at liberty to obtain our instance, and modify it as wanted.