Jump to content

Happy Birthday Email to Clients - ready and working (WHMCS 5.3.9)


Recommended Posts

We have managed and finalized now a PHP page, which send automated HTML formatted emails to the clients. This codes are NOT a module and are open to modification and adjustments.

 

We are not PHP experts and had a quite hard time as well as some fun, developing it. There is no automated installation routine. The current code contains a PDF file with detailed instructions how to install and configure required settings.

 

The PHP code, containing a basic "Happy Birthday Email" which can and should be modified is included as well as the documentation, how to adjust some of the features of the email.

 

The code file as well as the documentation can be downloaded a zip file from /https://portal.it-bizz.net/cart.php?a=add&pid=186&sld=whmcs&tld=.com

 

Pricing: USD 5.00 including basic installation support by email

Link to comment
Share on other sites

Hi

 

You could use the in-built Email features of WHMCS instead of calling a separate script. You could just create a new multi-language Email Template under Setup > Email Templates then query database to get the IDs of all clients that were born today.

 

SELECT clientid FROM someteable WHERE birthdate = CURDATE()

 

Then you iterate IDs in a foreach to send emails via internal API:

 

foreach($clients AS $id)
{
   $command = "sendemail";
   $adminuser = "admin";
   $values["messagename"] = "Happy Birthday Email";
   $values["id"] = $id;

   $results = localAPI($command, $values, $adminuser);
}

 

You have to run this script on daily basis automatically so maybe the best approach is to hook it to DailyCronJob Action Hook.

 

function BirthDay_Email()
{
// query db, iterate and send email via API
}

add_hook("DailyCronJob",1,"BirthDay_Email");

Done.

Link to comment
Share on other sites

Well most of things I wrote was pseudo code :) Anyway there's only one thing missing in your project in my opinion. Thre should be a security measure to prevent clients to cheat on their birthdates. Let's suppose that as gift you send coupon codes via email. One of your client could change his birthdate everyday to get birthday gifts 365 times per year. Of course I'm supposing that clients can change this value from client area (can they?).

Link to comment
Share on other sites

All you have to do is have a token field in the table and load the token when the bd is rendered. Once that is done then it cant be done til the next year. Also you could easily just use an encrypted token with the original dob and compare it to that to keep people from cheating the system.

Link to comment
Share on other sites

The main reason i suggested what i did was because it would mean no template mods. Hiding a custom field would mean a template mod which would need to be replaced every time a whmcs occured. Yes the db is more work up front but less to worry about overall, it just does its job and no hassle at updates.

 

 

Also there is no reason to hide it, just after they register then make it read only. They can see it but cant change it.

Link to comment
Share on other sites

  • 7 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated