Wife/Girlfriend/Sister?
Pepper Spray &
Stun Gun Specials!
KEEP THEM SAFE.
 CoverYourASP --> Removing unconfirmed members --> Part 4

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
34 active users
1873 visitors today
2392 pages today
(only part of today)
Tools I use

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

ASP.NET Blog
RSS submissions
E-commerce

Now open source with SourceForge!

Emailing a reminder

I wanted to email the prospective member, and give the option in the email to quickly confirm his membership, so I used the same code as in the original sign up page to include the link to C.asp.

(Of course, it's possible that I should have moved this "duplicate code" into an SSI, but I judged that the duplication was minimal)

if ( dDate.getDate ( ) == nDate )
{
   var sEmail = '' + oRecordSet ( 1 );
   var sName = '' + oRecordSet ( 2 );
   var sDate = FormatDateDMY ( dDate );

   // send Email with our generic function
   var sBody = 'Dear ' + sName + '\n\n';

   sBody += 'Today is your last chance to confirm your membership on CoverYourASP.com!\n\n';
   sBody += 'Membership accounts have to be confirmed via email - and unconfirmed accounts are only kept for 10 days. Since you registered on ' + sDate + ' your membership account will be deleted tomorrow unless you confirm your account.\n\n';
   sBody += 'To confirm your CoverYourASP membership account please click on the link below, or copy and paste the entire URL into your  browser.\n\n';
   sBody += 'IMPORTANT: if the link below is wrapped onto two lines by your email software please copy from the "http" to the end of the number on the second line, then paste that into your browser.\n\n';
   sBody += 'http://CoverYourASP.com/C.asp?a=a&e=' + sEmail + '&i=' + nID + '\n\n';
   sBody += 'I hope to hear back from you soon!\n\n';
   sBody += 'Member Services\n';
   sBody += 'MemberServices@CoverYourASP.com\n';
   sBody += 'http://CoverYourASP.com/';

   if ( -1 == sServer.indexOf ( 'localhost' ) )
      SendEmail ( 'MemberServices@' + sHostDomain, sEmail, '', 'Final Notice: Lapsing CoverYourASP membership', sBody );
}

Fairly straight-forward code I hope you'll agree. Get the email and name of the member from the recordset, then make up the body of the email in the sBody variable.

Two things to note:
• The use of \n as a linefeed in JavaScript.
• How I don't send the email if running from localhost, i.e. my development machine! The sServer variable is set globally in Init( ), and contains the value of Request.ServerVariables ( 'SERVER_NAME' ).

Part 5: Deleting unconfirmed members...

Featured sponsor
My favorite resources

Tiki Statues - Tiki Masks - Tiki Totems



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!

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?