The purpose of the Bulkmail Package is to allow MySource Matrix content to be sent to users via email, either once off or on a scheduled basis. Examples of usage for this package include weekly newsletters, promotional mailouts, subsciber emails etc. This article shows you how to quickly setup a bulkmailer in your system.
Before you start, make sure that you have the required PEAR packages installed by running "pear list" command.
The Bulkmailer also uses PHP process control support, so you have to compile the CGI or CLI version of PHP with --enable-pcntl configuration option.
The Bulkmail Package consists of four major components - Bulkmail Manager, Bulkmail Post Offices, Bulkmail Jobs and the Bulkmailer. The Bulkmail Manager will be created as a system asset when you install the bulkmail package in your system. To quickly get your bulkmail system running, you should create a Bulkmail Post Office, a Bulkmail Job and the crontab for the Bulkmailer at a minimum.
The post offices provide the ability to create default options for the jobs beneath it. If all your jobs have the same recipients or the same headers, then you would set those in the post office and the jobs beneath it would inherit the values. You can override the post office values on a job-by-job basis.
Please note that if you do not specify a post office, the default system post office will be used (located in System Management -> Bulkmail Manager -> Default Bulkmail Post Office).
The basic purpose of these assets is to define the settings of the email server you will be sending all the emails through. This can be an SMTP server on the local/remote machine, or alternatively you can just use sendmail on the local machine. If you have a number mail servers you use for different purposes, you would have a post office defined for each.
The Header Details Section allows you to specify the header values of the mailout. You may use the standard asset keywords as header values. Please visit the documentation page for a complete list of available keywords. The 'From' and 'Subject' field must be filled in order for the mailout to work.
Additional rules may be defined for all Bulkmail Jobs beneath this Post Office. For example, the Excluded Time rule is where you define a "black out" period so that no jobs will be processed, it is particularly useful to ensure that the mailouts do not get sent during peak hours.
The Bulkmail Job defines which content is being sent, as well as the recipients, headers, and content generation type. The job can also inherit the values of the post office it is linked under (note that jobs can only be linked under ONE post office). The process for setting up a job is as follows:
You may use the multiple asset finder to select users or user groups you wish to send the email to. Problematic users that are not Live or without an email address will not receive the mailouts.
You may select the asset to send as the bulkmail content in Asset to Send, this can be a Page asset or any asset of its decendent types.
The Generate As option allows you to specify a user to be used to generate content for all recipients based on his read/write/admin access, if the Generation Method option is set to "Generate as set user". If the Generation Method option is set to "Generate as recipient", the bulkmailer will generate content for each recipient. The user specified above will be used if the bulkmailer failed to generate content for a specific user.
Finally, you may use the asset finder to select the Design and the Layout to be applied to the content. One other thing to make sure of is that your Designs and Layouts are Live and have public read permissions turned on, and the same with any images that will appear in the content. One of the major problems with sending out HTML emails with image content is that when 100,000 people receive the email they will open it and your server will be brought to its' knees. One way to prevent this from happening is by using a separate server to serve your files (configure the SQ_CONF_STATIC_ROOT_URL option). For further details on how this is done, please contact Squiz support.
You may inherit the settings in the Post Office by selecting Use Post Office Header Details option or you may choose to overwrite the Post Office header detail settings by defining your own.
The bulkmailer is setup to run via CRON every x minutes. When the bulkmailer detects a job that needs to be run, it will get all the information it needs, generates the content, and sends all the emails. To set up the bulkmailer to run every 15 minutes, you will need to create a cron entry (running as www-data or apache) as follows:
*/15 * * * * php /path_to_matrix/packages/bulkmail/run.php
Run "man 5 crontab" for more information on scheduling using cron.
The Bulkmail Manager provides an interface to view all queued/running jobs in the system. Jobs can be paused, resumed or cancelled from this interface. The interface is available in post offices (you can view all jobs which are being sent through a particular post office), and in the job asset too. Progress of all jobs in the system can be monitored via the Bulkmail Manager as well.