Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 24th, 2005, 08:52 AM
Authorized User
 
Join Date: Aug 2004
Location: Delhi, Delhi, India.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Prabhakar_dt
Default Generate birthday wish

Hi to All,
   I have a site where user will register and fill his birthdate on the form and it will save on database.

I want to send them birthday wish 7 days before his birthday. It should be an autogenerated mail. And it should always check birthdate and send greeting if his birthday is after 7 days.

Thanks in Advance

Prabhakar Kumar
__________________
Prabhakar Kumar
  #2 (permalink)  
Old January 24th, 2005, 10:07 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

All these types of things can be done with VBS file. Then you can put the file in the scheduler of hosting server.

VBS file is one containing VBScript and with extension .vbs. You can do almost all things you do in a typical ASP page with VBScript (connect to database, send a mail etc. etc.) There are slight syntax and command variations.

More help on VBS can be had from

http://www.w3schools.com/vbscript/default.asp

Please note that, simply having a .vbs file on your server is not enough for this. You need to put it on scheduler of server to run once everyday at a particular time. You will require help of server administrator for this.
  #3 (permalink)  
Old January 25th, 2005, 01:20 AM
Authorized User
 
Join Date: Aug 2004
Location: Delhi, Delhi, India.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Prabhakar_dt
Default

Thanks Madhu.
But If u can write me some brief idea about the code then it will to useful for me...
Now I am trying to write the code, but your help is necessary for me.

Thanks again...


Prabhakar Kumar
  #4 (permalink)  
Old January 25th, 2005, 01:23 AM
Friend of Wrox
 
Join Date: Dec 2004
Location: Chennai, Tamil nadu, India.
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

You might want to check this :: http://www.asp101.com/articles/john/...le/default.asp

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com
  #5 (permalink)  
Old January 25th, 2005, 01:44 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

The code logic will be :

First - create the template for the mail. There should be place holders for name in the template. You may just use {{firstname}} and {{surname}} as place holders. (A template is nothing but an HTML file with place holders like these in places where you want to show name etc.)

Fetch all records whose birth anniversary is after 7 days from today. I cannot write the query as i don't know the structure of database.

Go through each of these record. Read the template. Replace place holders with corresponding values from database. You can use replace function for this.

Create cdo object. set its attributes and send the place holder replaced template as mail.

First you can create an asp page for this and then test it by running it at server. After checking for some 2 - 3 days, you can change the extension to .vbs. Please note that response.write will not work on vbs file. (And you don't require such a statement in this file except for debugging).

It is recommended that the asp page be a stand-alone page without any include files. vbs file is not running from a server so any paths defined with server.mappath need to be replaced with the actual full physical path.

Hope this is enough.
  #6 (permalink)  
Old January 25th, 2005, 09:07 AM
Authorized User
 
Join Date: Aug 2004
Location: Delhi, Delhi, India.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Prabhakar_dt
Default

Thanks Madhu and Vadivel
I will try to use your processes and i think that it will be useful for me.

Thanks Again


Prabhakar Kumar
  #7 (permalink)  
Old January 29th, 2005, 01:26 AM
Authorized User
 
Join Date: Aug 2004
Location: Delhi, Delhi, India.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Prabhakar_dt
Default

Hi...How I will put a schedule task on server. The server admin are not providing this facility to me. Is there any other way to excute any script which will send birthday card automatically,and we can put that script with all other scripts.


Prabhakar Kumar
  #8 (permalink)  
Old January 29th, 2005, 01:51 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

That is very bad. (Server administrators should be some more understanding !!!).

There are two other ways(not perfect or professional).

1) Are you aure that atleast one page of the site will be visited by atleast one person daily ? If yes, you can make your script into an include file and include at the top of every page. A modification is required in the script. You need to store the info that when this script is last run in a text file or database. If the script is not run today, then run it to send birthday wishes.Then update the text file to store the last run date as today.

2) Make a page which contains a meta refresh which will refresh the page in one day. Include your script (to send birthday wishes) in this page. Then have this page always opened in a browser on any suitable computer. The page will get refreshed once every day and then the mails will be sent.

As I told you, both these methods are not professional nor offer 100% success.
  #9 (permalink)  
Old January 29th, 2005, 02:09 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Please forget about the two non-professional methods if you are using SQL server database. I just found out that you can connect a remote SQL server using VBS.

This means you can change the connection string of VBS file so that it connects to remote SQL server. Then you can put the vbs in any machine you want.

There is also an another brilliant solution offerred by SQL server 2000. You can use the SQL mail feature of it. You can create a scheduled job in SQL 2000 which can send SQL Mail on every day. Please refer BOL for more info on this.


Similar Threads
Thread Thread Starter Forum Replies Last Post
generate index rshan XSLT 1 May 23rd, 2007 01:14 AM
Send Auto Mail for Birthday wishes bspradeep Classic ASP Professional 4 February 28th, 2007 06:13 AM
Email to todays Birthday users t400 SQL Server 2000 2 September 6th, 2006 08:24 AM
Auto generate no mateenmohd Classic ASP Basics 3 June 11th, 2006 07:06 AM
How to generate PDFs sonicDace XSLT 1 November 25th, 2003 11:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.