Start ::
Extensions and Distributions Support ::
Modules ::
Email on Birthday
Moderated by: Support Team
-
- rank:
-
Softmore
- registered:
- January 2005
- Status:
- offline
- last visit:
- 29.01.05
- Posts:
- 72
I am using Anniversaire where user input there birthday. Now I want to automatically mail user to their supplied mailing address(if any) in core My Account area on their Birthday(from Anniversaire input).
Sending Birthday wishes to user's private message folder will be nice addition!
How to proceed?
Or is there any module that supports birthday+email? -
- rank:
-
Helper
- registered:
- August 2002
- Status:
- offline
- last visit:
- 05.10.06
- Posts:
- 147
Hi,
1) Find if any birthdates match todays date. To do that you will need to run an SQL query against the DB and see if it matches todays date ( I guess that query allready is made in the module )
2) You need to send the result. That you can do by a mail() or what ever your server supports. This will have to go inside the if-test in 1) if ( dbdate == todaydate){ action goes here....
3) Here comes the issue... As PHP is not runned by it self it needs to be activated. You can do this test in the module it self... to e.g check for birthday and write a 1 to a sent column or something. It will then be activated everytime someone uses the module ( the write to DB will prevent multiple mailsendings). But what if no-one uses the module for a day ???? well, then no mails will be sent. You can ofcourse to a backwards test.... and send a delay congrats...).... The alternative is to run a cron job at a certain hour each day. This will be cleanest and with less code. It is however a bit more tricky as you will need cron on your server, and know how to set it. When this is said, it is not that hard
All in all the answer is that what you seek is not hard to do... it will need some 10 lines+ of code.
Regs
StormS -
- rank:
-
Helper
- registered:
- August 2002
- Status:
- offline
- last visit:
- 05.10.06
- Posts:
- 147
1) Yes you can use pnTresMailer, you will need to make a plugin and the code will need to search a large part of the file as I guess you wouldn't send newsletter everyday ???
2) CRON is just a way of making automated jobs possible. Most webservers/hosters offers cron and jobs to be runned each minute. It is a single line command that you will at to a crontab file that tells the cronsystem which file to execute and when.... You can run e.g every min, once a day at xx clock, once or twice a month... in short it is very customable.
The cronline may look like this:
That will run each tuesday or so at 5 o'clock if I'm not wrong...
You need to figure out if your hoster offers cron as a part of the package. Doing your request this way is the very best way of doing it.
Regs
StormS
Start ::
Extensions and Distributions Support ::
Modules ::
Email on Birthday
