This page is currently revised

Develop your own MailBeez

2 minutes, 0 second
design Development


Technically MailBeez is a framework for developing Trigger Email Campaigns.

A new MailBeez module can be developed very quickly. You only need to focus on building the Trigger Query Loop. MailBeez is taking care of putting together the email with using a template and a content file, sending the email out. Each email is tracked so it won’t be sent twice.

Let me take you very quickly through the concept – it is probably most easy for you to start from an existing MailBeez Module.

Build your Trigger Query

The following example shows how the receipients for a Birthday Greeting are selected.
An remember:each receipient will receive exactly 1 email per year ;-)

[php]
class birthday extends mailbeez {

// (…) some settings here

function getAudience() {
$query_raw = "select c.customers_firstname, c.customers_lastname,
c.customers_id, c.customers_email_address, c.customers_dob,
date_format(c.customers_dob, ‘%d.%m.’) as date_of_birth
from " . TABLE_CUSTOMERS . " c
where date_format(c.customers_dob,’%m%d’) < ( date_format(now(),’%m%d’)+ " . MAILBEEZ_BIRTHDAY_BEFORE_DAYS . ")
and date_format(c.customers_dob,’%m%d’) > ( date_format(now(),’%m%d’)- ". MAILBEEZ_BIRTHDAY_PASSED_DAYS_SKIP . ")";

$query = mh_db_query($query_raw);
while ($item = mh_db_fetch_array($query)) {
// mandatory fields:
// – firstname
// – lastname
// – email_address
// – customers-id

$this->audience[$item['customers_id']] = array(
‘firstname’ => $item['customers_firstname'],
‘lastname’ => $item['customers_lastname'],
‘email_address’ => $item['customers_email_address'],
‘customers_id’ => $item['customers_id'],
‘date_of_birth’ => $item['date_of_birth']
);
}
return $this->audience;
}

// (…) and some settings here

}

[/php]

of course you can build whatever your want to fill the audience-array!

No restrictions: since MailBeez Modules are running in the catalog environment, you can include any functionality from you shop front-end.

Build the Email Template

Following the html-code in the file body_html.tpl

[html]

Happy Birthday!




firstname: $firstname

lastname: $lastname

customers id: $customers_id



email: $email_address

birthday: $date_of_birth

[/html]

Using the common HTML Email template located in mailhive/common/templates the email will look like this:

Birthday Email

of course when sending the content will be personalized for the receipiente using the data you filled in to the array.

Imagine…

…how fast you can build Automatic Trigger Email Campaigns. Season Greetings, Holiday Greetings – you might give a Discount Coupon – can build within minutes! You can focus on building the Trigger Query and your are done.

Next Post    Previous Post

Top