Skip to content

Sending Queued Emails

objectivehtml edited this page Dec 12, 2014 · 14 revisions

Overview

Postmaster has the ability to send parcels in the future. Once your parcel(s) is configured to send messages in the future, you are going to need to send them. Postmaster makes sending items from the queue at the right time real easy. There are two ways to it:

CRON Job

The easiest option is to setup a CRON job that sends an HTTP request at frequent interval. For active queues, you may need to send a request every 5 minutes. Other sites with low traffic may only need to do so once an hour. The interval at which you ping queue is completely up to you.

//yoursite.com/postmaster/queue/marshal

Anytime a request is sent that URL Postmaster will check to see if any items in the queue need to be sent. If there are no items in the queue that need to be sent, nothing will happen.

Queue API

If you need to programmatically trigger the queue you can do so using the following method:

craft()->postmaster_queue->marshal()

If you need to send an item to the queue you can do so using the following method:

craft()->postmaster->sendToQueue($transportModel)

Note, you must pass a Postmaster_TransportModel object to the sendToQueue() method.