Jump to content

Is it possible to schedule custom emails?


Isaac Asher

Recommended Posts

I have a custom client field which I use to store a date.  I would like it if I could schedule an email to go to the client on that particular date (and/or in consideration of other custom fields) via the cron job, if possible. 

Does anyone know if it's possible to add such automation via the admin?  If not, where can I go to learn more about the method to do this?  I can work with PHP, HTML, CSS easily enough, so that won't be an issue. 

Thanks in advance!

Link to comment
Share on other sites

As far as I know not via Admin interface. You'll need an action hook like this one.

function customPrefix_PreCronJob()
{
    // Get clients matching your criteria in $clients variable

    foreach($clients as $client)
    {
        $postData['messagename'] = 'Your Message';
        $postData['id'] = $client['id'];
        $postData['customvars']['something'] = $client['something'];

        localAPI('SendEmail', $postData);
    }
}

add_hook('PreCronJob', 1, 'customPrefix_PreCronJob');

 

Link to comment
Share on other sites

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