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?
- craigh responded to »TagIt 3.0 for Zikula« 03:58 PM
- jmvaughn responded to »error when i try to upgrade to the last version of dizkus module (3.1)« 12:05 PM
- localrags responded to »Remove contents of nuke_sc_anticracker from Database« 11:30 AM
- jmvaughn responded to »Shoutit for zikula 1.3?« 09:31 AM
- mdee responded to »Different page content under one template (tpl file) based on URL« 07:17 AM
- espaan responded to »Categories disappear when editing ...« 08. Feb
- eledril responded to »How decrease zikula cpu usage« 08. Feb
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
Email on Birthday
-
**unknown user**
- Rank: Softmore
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 110
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 -
**unknown user**
- Rank: Softmore
- Registered: Mar 16, 2002
- Last visit: Oct 21, 2009
- Posts: 110
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:
Code
* 5 2 * * /usr/local/bin/php /www/x/xxxx/www/modules/birthdays/birthdaysmail.php
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
- Moderated by:
- Support
