Author Topic: Birthday Email  (Read 9988 times)

collin

  • Posts: 2
    • View Profile
Birthday Email
« on: March 15, 2006, 01:36:40 pm »
Hi!

I'm loving your software!  It is working really well for us!  There is one thing we really need for a client.  We need to be able to send an email on an subscribers birthday.  Right now we have a user field that stores the birthday in a M/D format.  Then I was thinking I could make a custom user list with th e nice little sql query tool you have.  Basically select users where current date = birthday.  My problem is... how do I tell Daily mail to send this stored message everyday?  The message could be pulled from a url or possibly stored in mysql.  I just don't know whats the best way to setup a daily email.  Any help would be greatly appreciated!  We would be willing to pay for this feature and share it with the rest of the community.

Thank you!

DW

  • Administrator
  • Posts: 3787
    • View Profile
    • http://listmailpro.com
Birthday Email
« Reply #1 on: March 18, 2006, 03:42:45 am »
Quote
I was thinking I could make a custom user list with the nice little sql query tool you have. Basically select users where current date = birthday

I do not believe searching a custom field for the current date is possible with the current implementation of User Selection.  I think the only way to do this from within the program would be with a 'Custom Query' selection and only providing that MySQL has internal functions to return the current date.

Quote
How do I tell Daily mail to send this stored message everyday?

As of yet there is no ability to repeatedly send a scheduled message. It should be possible (and fairly easy) to use a custom script to insert the desired scheduled message every day before dailymail, however.  Come to think of it, a User Selection search query could also be updated when this scheduled message is inserted, eliminating the problem, so the steps are:

1) Update User Selection search query (specific id) to the next day dailymail runs.
2) Insert scheduled message to be picked up and processed by dailymail.

While it may not be the most desirable way to enter your messages, if you're familiar with PhpMyAdmin you could set up a scheduled message as desired, perform an export, change the "id" field to a null value, escape any quotes (" becomes \") and copy and paste the SQL query into a PHP mysql_query() function like this:
Code: [Select]

<?php
 
// place this code in a .php file in your ListMail folder and browse to it
 // http://example.com/script.php?pw=1234
 
if($_GET['pw']<>'1234') exit('invalid pw');
 include(
'./config.php');
 include(
'./admin.php');
 
$bday date("Y-m-d");
 
// if dailymail runs the next day (ie. AT midnight with this script running at 11:55, add a day.)
 // $bday =  date("Y-m-d",mktime(date("H"),date("i"),date("s"),date("m"),date("d")+1,date("Y"));

 // selection id (click Edit next to your selection and check for the following in the address bar: "&rsid=1"
 
$selection_id '1';
 
// update selection (note that this updates ALL queries for all rules in a selection, but you should only need one rule)
 
mysql_query("update lm_selectd set q = '$bday' where rsid = '$selection_id';");

 
// insert scheduled message
 // Note*** remove first field value from export: 
 // $cmd = "INSERT INTO `lm_schedule` VALUES ('2', 
 // -becomes-
 // $cmd = "INSERT INTO `lm_schedule` VALUES ('',

 
$cmd "INSERT INTO `lm_schedule` VALUES ('', 'm', '2006-03-18', 'Example Saved Message', 'Example Saved Message\r\n\r\nDate1 = !date\r\n\r\nDate2 = !date2\r\n\r\n\r\n-----\r\n!remove', '', '', 'rs1');";

 
mysql_query($cmd);
?>



You do not need to update the date of the scheduled message as dailymail will send any messages that are scheduled before the current day.  I recommend scheduling this script to run 5 minutes before dailymail each day.  If dailymail runs at midnight uncomment the appropriate line to increase the day by one.

I could assist directly for as low as $20 :).

Regards 8)
Dean Wiebe
ListMailPRO Author & Developer - Help | Support | Hosting

collin

  • Posts: 2
    • View Profile
Birthday Email
« Reply #2 on: March 21, 2006, 10:30:40 am »
Thank you!  I got it all up and running!  Thanks again!