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
23 active users
2028 visitors today
1576 pages today
(only part of today)
Tools I use

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

ASP.NET Blog
RSS submissions
E-commerce

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\[email protected]' + sHostDomain;

SendEmail ( sFromEmail, sToEmail, '[email protected]' + 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

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?


See my source code
wherever you see this icon...

You can also download the entire site source code for FREE!