How to send an Email at a scheduled timeEstimated Reading Time: 2 Minutes
In this article we will cover how to correctly schedule Emails to be sent out at a specific time and date, as well as other smaller things to watch out for when planning and setting up scheduled mails.
Setting up the scheduled Emails
The whole setup revolves around the “Publish / Unpublish” option when creating an Email. If you want to take a deeper look into the capabilities of “Publish / Unpublish”, we have a Knowledgebase article that explains how to use the feature in detail: Explaining the Publish/Unpublish feature
First of all, create the Email you want to send out, i.e. a newsletter that you are planning to send out next week. After you are finished with the content, go to the editing page of your Email where all the configuration is done. There you find the option to set a publish date as well as an unpublish date.
Here you can define the date/time of when your Email should be published, in other words when it should be sent out.
In this example our date is exactly one week in the future at 8 pm. Here is the first smaller piece of advice when it comes to setting up the time. The time settings you define in your system configuration are responsible for the timing your email will be sent out. If you have your system running on UTC, the email will be sent at 8 pm UTC time.
The Cron job needed for scheduling emails
When sending out scheduled emails you will need to add a cron job to your crontab. If you are new to cron jobs you will find a guide here: <add link to cron jobs guide> and on the End User Documentation at https://docs.mautic.org/setup/cron_jobs
The cron job you need to add is the following:
php path/to/mautic/ bin/console mautic:broadcasts:send
This cron job is directly responsible for sending out scheduled emails. We advise you to pair it with the email queueing feature to guarantee a smooth and reliable sending out. If you need more information about that you can get a detailed setup-guide right here: <insert link to article on queueing>