ASP/.NET Web Hosting
* 3 Months FREE *
CLICK HERE!
 CoverYourASP --> Recommending your site

Free membership

Join in the fun! Sign in
Member Services

Site navigation
Download the entire site!
Search my articles
Free Magazines
Browse the directory

Send me feedback
Buy my boxer shorts

Recommend this page
Printer-friendly page

Resources I recommend
Link to my site
Advertising slashed!
About your privacy
Legal stuff
Site statistics
109 active users
10147 visitors today
10982 pages today
how is this done?
ASP.NET Showcase
ASP.NET Graph and Chart Component with FREE developer version

ASP.NET Shopping Cart and E-commerce Control with FREE trial download

ASP.NET Web Hosting with free month and setup

$15 Domain Name Registration from .DNR.
As seen on these sites
Special thanks go to the sites that support me by publishing my articles.
See more

CoverYourASP
Copyright © 1999-2008 James Shaw.
All rights reserved.

ASP.NET Blog
ASPRSS
ShawThing

Now open source with SourceForge!

It's obviously important to give your readers a way to tell their friends and colleagues about your site - it's free advertising after all. That's why I put the Tell your friends link at the top of every page.

Luckily, it's very easy to do - it's just another form that sends email. In fact, most of what you need to know is already documented in my article about my feedback form.

Read these first...

1. If you're not familiar with how to write <form>'s with ASP, read my <form> article.
2. Next, read my article about getting feedback email.

What's different...

Well, uh, not much. Both the feedback form and the tell-a-friend form use the same SendEmail email function - it's just that in this case the form asks for both sender and recipient email addresses.

if ( sFromName == '' )
   sFromName = '[Anonymous]';

var sSubject = sFromName + ' wanted you to check this site out';

var sBody = 'Your friend or colleague, ' + sFromName + ', thought that you would like http://' + sHostDomain + '/ - I hope you\'ll visit!\n\nBest Regards\nJames Shaw\njames@' + sHostDomain;

SendEmail ( sFromEmail, sToEmail, 'Recommended@' + sHostDomain, sSubject, sBody );

I use the word [Anonymous] if the user doesn't supply his name, then make up a subject and body for the email.

sHostDomain is a variable you set in the configuration file (include/config.asp) when you download all my source code to run on your PC. In my case it is set to "CoverYourASP.com". By changing that variable every email and reference to the domain name changes.

What's that "\n" part? That's how you specify a linefeed in JavaScript (or C or C++).

See the actual source code for the page by clicking the icon below.

Featured sponsor
My favorite resources

Selling products online - read how James does it now


CoverYourASP Mugs, T-shirts, caps - even Boxer shorts...
I don't make a penny from these, but they're a lot of fun! Don't you need a new mouse mat?


New Proposal Kit Professional 5.1
Brand yourself as a top professional: create quotes and amazing proposals and get many legal documents free!

The latter saved me 3 times the purchase price on the first day I owned it!