Jump to content



Photo
* * * * * 1 votes

Automatic Trigger Email Campaigns with MailBeez Modules


  • Please log in to reply
498 replies to this topic

#1   MailBeez

MailBeez
  • Partner
  • 237 posts
  • Real Name:Cord
  • Gender:Male
  • Location:Denmark

Posted 27 May 2010 - 22:04

This is the official Support Forum for http://addons.oscommerce.com/info/7425

Hi all,

am working with osCommerce sind 2003 and after a couple of ecommerce projects I wanted to be able to automize emails - for almost 5 years I was looking for a simple solution to build automatic email campaigns. Currently between jobs I was able to invest some time to develop MailBeez.

MailBeez is a modular system for the implementation of Automatic Aftersales Trigger Email Campaigns.


examples:

  • Customer satisfaction surveys after a defined number of days after sending
  • Review Reminder after a couple of weeks
  • Birthday and Season Greetings in connection with Coupon Codes
  • Service Emails for e.g. wearing parts, maintenance updates
  • Customer reactivation emails – make a personal offer e.g. 6 months after last order
  • Payment reminder of e.g. Cash in Advanced or Invoice payments



MailBeez supports the development of both Transactional and Recurring Trigger Email Campaigns.

Enjoy MailBeez and let me know what you think.

Cord

#2   MailBeez

MailBeez
  • Partner
  • 237 posts
  • Real Name:Cord
  • Gender:Male
  • Location:Denmark

Posted 09 June 2010 - 19:29

New MailBeez Modules are available:

MailBeez Module: Review Reminder
http://addons.oscommerce.com/info/7433

MailBeez Module: Share Review on Facebook
http://addons.oscommerce.com/info/7434

MailBeez Module: Winback Customer Reactivation
http://addons.oscommerce.com/info/7432


in progress:

* Recover Cart Sales
* X-Sell Cross Sell Emails

#3   sublok

sublok
  • Members
  • 28 posts
  • Real Name:J
  • Gender:Male

Posted 12 June 2010 - 18:11

I did have another thought, while talking over some ideas, perhaps mail beezs should be linked to the newsletter option value, in the customer accounts or ever create a secondary account option like email notifications? y/n.

#4   MailBeez

MailBeez
  • Partner
  • 237 posts
  • Real Name:Cord
  • Gender:Male
  • Location:Denmark

Posted 13 June 2010 - 20:44

I did have another thought, while talking over some ideas, perhaps mail beezs should be linked to the newsletter option value, in the customer accounts or ever create a secondary account option like email notifications? y/n.


Hi Sublok,

In my sales region it is legally ok to send email related to a business-interaction w/o an additional agreement.
Therefore I have following approach implemented in my prototype system: Customers can "block" each module by clicking on a link "no emails like this" (one-click-blocking - no password).
Hope I will soon find some time to integrated this into MailBeez

Otherwise you can always use SQL join queries to check additional values, example could be a MailBeez Module which sends an update to all subscribers of "products_notifications" in case of e.g. the product gets a promotional price in "specials".

enjoy mailbeez!

#5   betoosc

betoosc
  • Members
  • 4 posts
  • Real Name:Alberto
  • Gender:Male

Posted 16 June 2010 - 11:43

hi cord
I would like to expose here the conversation we had by mail.
I would like to make mailbeez more versatile, I mean that all kind of mail we send to the customers have the same look. So because the structure there are too many things to be modified. I would like to work on a line that these changes could be correctly adapted to this wonderful contribution. So for you Cord and the people interesting on contribute in this module, I would like to invite you to make your appointments and suggestions

regards,
Irene

#6   MailBeez

MailBeez
  • Partner
  • 237 posts
  • Real Name:Cord
  • Gender:Male
  • Location:Denmark

Posted 16 June 2010 - 12:08

hi cord
I would like to expose here the conversation we had by mail.
I would like to make mailbeez more versatile, I mean that all kind of mail we send to the customers have the same look. So because the structure there are too many things to be modified. I would like to work on a line that these changes could be correctly adapted to this wonderful contribution. So for you Cord and the people interesting on contribute in this module, I would like to invite you to make your appointments and suggestions

regards,
Irene


hi irene,

I hope the way mailbeez is build makes it easy to adapt your emails to have a common look.

Common Look
in "mailhive/common/templates" you find a HTML-template which defines the common frame-template for all mailbeez-modules. Change this template to your common look.

specific content
In "mailhive/mailbeez/<mailbeezmodule>/email" you find the content-template for each mailbeez-module. Change the content of the emails you would like to send.


Any idea how to make it more versatile without adding complexity and still keep mailbeez modules easy to "plugin"?

regards
cord

#7   MailBeez

MailBeez
  • Partner
  • 237 posts
  • Real Name:Cord
  • Gender:Male
  • Location:Denmark

Posted 21 June 2010 - 21:14

Updates:

MailBeez Version 1.2

Bugfixes:
  • support of SSL in admin
  • set new doctype in admin/mailbeez.php to avoid issues with CeeBox in MS IE

New MailBeez Module:
MailBeez Module: Contact Customers without purchase (no order)
http://addons.oscommerce.com/info/7453

#8   MikeMike

MikeMike
  • Members
  • 154 posts
  • Real Name:Michael

Posted 21 June 2010 - 23:08

I just installed ver 1.2 and I can't get by the install step in admin. The button is still there after I have clicked it. I can see the table in the db has been created and it has 7 columns inside.
Any ideas why it don't take me to the settings after clicking the install button?

Also, I see you have made the link as nonssl in admin:

. '<br><a href="' . tep_href_link(FILENAME_MAILBEEZ, '', 'NONSSL') . '">MailBeez</a><br>'

I'm running it as ssl. Any special reason for making it nonssl when all other admin links are ssl??

#9   MikeMike

MikeMike
  • Members
  • 154 posts
  • Real Name:Michael

Posted 21 June 2010 - 23:25

Do I need to install some of the modules first maybe?

#10   MailBeez

MailBeez
  • Partner
  • 237 posts
  • Real Name:Cord
  • Gender:Male
  • Location:Denmark

Posted 22 June 2010 - 06:58

hi MikeMike,

the installation should be one-click - have designed and tested it with osCommerce, Zencart, CRELoaded and xtcommerce.

I guess you are having some kind of configuration caching in your admin site or some modifications around the config-values.

If you can't pass the "install"-button, the following check fails and therefore shows the install-button:

if (defined('MAILBEEZ_MAILHIVE_STATUS')) {... } else { // install}



Please check:
1. can you find 'MAILBEEZ_MAILHIVE_STATUS' in you configuration-table?
2. is there any configuration-cache in your system?

if you have a config-cache please let me know what to call for a reset, I will then add it to mailbeez.

For a quick fix you have to add you config-reset-call like this:

if (function_exists('tep_reset_config_cache_block')) {
tep_reset_config_cache_block('includes/config-cache.php');
}

if (function_exists('updateConfiguration')) {
updateConfiguration();
}



SSL: no, there is no reason not to call it as SSL, can't remember why thers is "NONSSL" in the link...

#11   MikeMike

MikeMike
  • Members
  • 154 posts
  • Real Name:Michael

Posted 22 June 2010 - 12:16

hi MikeMike,

the installation should be one-click - have designed and tested it with osCommerce, Zencart, CRELoaded and xtcommerce.

I guess you are having some kind of configuration caching in your admin site or some modifications around the config-values.

If you can't pass the "install"-button, the following check fails and therefore shows the install-button:




Please check:
1. can you find 'MAILBEEZ_MAILHIVE_STATUS' in you configuration-table?
2. is there any configuration-cache in your system?

if you have a config-cache please let me know what to call for a reset, I will then add it to mailbeez.

For a quick fix you have to add you config-reset-call like this:




SSL: no, there is no reason not to call it as SSL, can't remember why thers is "NONSSL" in the link...



Thanks!
I do have configuration cache installed. This is the add-on: http://addons.oscommerce.com/info/1862

I disabled it as described in the install instructions:

Removal

To disable this contribution, set the $config_cache_file variable to '' in admin/includes/configuration_cache_read.php and catalog/includes/configuration_cache_read.php.


and then I finally got to the settings instead of the install button. I guess I'll have to reset the cache before enabling it again, but I wasn't sure where to put your quick fix code...

#12   MailBeez

MailBeez
  • Partner
  • 237 posts
  • Real Name:Cord
  • Gender:Male
  • Location:Denmark

Posted 22 June 2010 - 12:28

This is the add-on: http://addons.oscommerce.com/info/1862


just check the contribution... not very elegant to work with an include instead of function-call :-o

Since admin/mailbeez.php is very similar to modules.php you need to do the same adjustments as described in the installation:

if (tep_not_null($action)) {
switch ($action) {
case 'save':
while (list($key, $value) = each($HTTP_POST_VARS['configuration'])) {
tep_db_query("update " . TABLE_CONFIGURATION . " set configuration_value = '" . $value . "' where configuration_key = '" . $key . "'");
}

// Configuration Cache modification start
require ('includes/configuration_cache.php');
// Configuration Cache modification end


tep_redirect(tep_href_link(FILENAME_MODULES, 'set=' . $set . '&module=' . $HTTP_GET_VARS['module']));
break;
case 'install'


All settings and options are stored in the configuration-system. So you need to add this to mailbeez.php otherwise your settings and changes in mailbeez are not saved.

#13   trentano

trentano
  • Members
  • 2 posts
  • Real Name:trentano

Posted 23 June 2010 - 12:46

hi mailbeez

great job !
i´ve installed mailbeez in our testshop. started by hand - it works fine.
but if i set a cronjob (for example at http://www.cron-job.org)i get an error.
the response is too big to handle. the URL has mor than 1024 Bytes Data. execution canceled.
wow can i solve the problem.

the cronjob - calls the secure url - like this ... http://your-server.c...eb51c9a5147=run

greets from germany

andy

#14   MailBeez

MailBeez
  • Partner
  • 237 posts
  • Real Name:Cord
  • Gender:Male
  • Location:Denmark

Posted 23 June 2010 - 20:19

the response is too big to handle. the URL has mor than 1024 Bytes Data. execution canceled.


looks like the cron-service doesn't like that mailhive.php generated output.

So I will need to build in a "silent mode"...

In the meantime you could do following workarounds:
  • find another cronjobservice that supports output
  • build a php page which uses curl to call the mailhive url


for 2. you could use something like minihive.php and call this through the cronjob


minihive.php (not tested)
<?php
    function getCurlContent($url) {
      $ch = curl_init();
      curl_setopt($ch, CURLOPT_URL, $url);
      curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,  2);
      curl_setopt($ch, CURLOPT_USERAGENT, $this->user_agent);
      curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); 
      curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
      curl_setopt($ch, CURLOPT_TIMEOUT, 30);
      $content = curl_exec ($ch);
      
      if (empty($content)) {
        print curl_error($ch);
      } else {
        $info = curl_getinfo($ch);
      }
      
      curl_close ($ch);
      return $content;
    }	

    $url = "http://yourserver.com(...)"; // mailhive-url to call
    $return = getCurlContent($url); // run the mailhive url request

    echo "ok"; // just a short output.

?>

german greetings from denmark ;-)

#15   fharos

fharos
  • Members
  • 9 posts
  • Real Name:Rémy

Posted 24 June 2010 - 07:22

Hi Mailbeez,

Congratulations for your great work !
I've a little problem : i just want to insert some php in the birthday mail and i do not know how to do.
I've read some stuff on the web but nothing can help me.

I've a php file with php and i want to call him in the tpl.

Thxs for help

Fharos

#16   MailBeez

MailBeez
  • Partner
  • 237 posts
  • Real Name:Cord
  • Gender:Male
  • Location:Denmark

Posted 24 June 2010 - 07:41

hi fharos,

you need to do your php-stuff in the birthday.php file and assign the result to a new placeholder, e.g. like this:

function getAudience() {
 (...)

  // do it here if it is common for all
  $fharosResult = fharosPHPCall();

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


    // do it here if you want to personalize it
    $fharosResult = fharosPHPCall();

    $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'],
        'fharos_cool_stuff' => $fharosResult // here you assign the content of the placeholder
        );
   }
  return $this->audience;
}


in the tpl file you can do the output like this:

...
look at this: [b]$fharos_cool_stuff[/b]
...

please let us know what smart things you are doing (a coupon-code?) - might be of interest for many others as well ;-)

#17   fharos

fharos
  • Members
  • 9 posts
  • Real Name:Rémy

Posted 24 June 2010 - 08:41

THXS,

I think i'm stupid (off course i'm french ;-) )
It doesn't work.

I'm a beginner in php development.

I've a php file named : coupon_dob.php placed in : catalog/mailhive/mailbeez/email
This file contain a little part of code like this :
<?php

            $jour = date('j');
            $mois = date('m');
           
            //

if ($jour == 22 && $mois == 06) 
{
$dob = "France will not win the Fifa World Cup......."; 
}
else
{
$dob = "Off course not !";
}
?>

And my birthday.php file contains this :
<?php
/*
  MailBeez Automatic Trigger Email Campaigns
  http://www.mailbeez.com

  Copyright (c) 2010 MailBeez
	
	inspired and in parts based on
  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/
    

	// make path work from admin
  require_once(DIR_FS_CATALOG. 'mailhive/common/classes/mailbeez.php');	
	
	// could be in language-file
	// just easier to define it in the mailbee
	define('MAILBEEZ_BIRTHDAY_TEXT_TITLE', 'Birthday Greetings');
	define('MAILBEEZ_BIRTHDAY_TEXT_DESCRIPTION', 'Be nice and remember the Birthday of your customers - this MailBeez Module sends birthday greetings.');	
	
  class birthday extends mailbeez {
		// class constructor
    function birthday() {
			// call constructor
			mailbeez::mailbeez(); 
			
			// set some stuff:	
      $this->code = 'birthday';
			$this->module = 'birthday';
			$this->version = '1.1'; // float value
			$this->iteration = date('Y'); // year
      $this->title = MAILBEEZ_BIRTHDAY_TEXT_TITLE;
      $this->description = MAILBEEZ_BIRTHDAY_TEXT_DESCRIPTION;
      $this->sort_order = MAILBEEZ_BIRTHDAY_SORT_ORDER;
      $this->enabled = ((MAILBEEZ_BIRTHDAY_STATUS == 'True') ? true : false);
			$this->sender = MAILBEEZ_BIRTHDAY_SENDER;
			$this->sender_name = MAILBEEZ_BIRTHDAY_SENDER_NAME;
			$this->status_key = 'MAILBEEZ_BIRTHDAY_STATUS';
			
			
			$this->documentation_key = $this->module; // leave empty if no documentation available
			// $this->documentation_root = 'http:://yoursite.com/' // modify documentation root if necessary
			
			$this->htmlBodyTemplateResource = 'body_html.tpl'; // located in folder of this module
			$this->txtBodyTemplateResource = 'body_txt.tpl'; // located in folder of this module			
			$this->subjectTemplateResource = 'subject.tpl'; // located in folder of this module
			
			$this->audience = array();
			$this->additionalFields = array('customers_id' => '007','date_of_birth' => '31.01.'); // list of additional fields to show in listing with testvalues
			// list of additional fields to show in listing with testvalues used for Test-Mail
    
}

// class methods
		function getAudience() {
			global $languages_id;
			
      $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);
			
			// for early check
			$mb_chk = new mailbeez_mailer($this);						
			
			while ($item = mh_db_fetch_array($query)) {
			// mandatory fields:
			// - firstname
			// - lastname
			// - email_address
			// - customers-id -> block
			
			// other keys are replaced while sending: $<key>
			
				// early check to avoid processing when email was already sent
				$chk_result = $mb_chk->check($this->module, $this->iteration, $item['customers_id']);
				if ($chk_result != false) {
					// this iteration for this customer was already sent -> skip
					continue;
				}
				
				$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;
		}
		
		
		// installation methods
		
    function keys() {
      return array('MAILBEEZ_BIRTHDAY_STATUS', 'MAILBEEZ_BIRTHDAY_BEFORE_DAYS', 'MAILBEEZ_BIRTHDAY_PASSED_DAYS_SKIP', 'MAILBEEZ_BIRTHDAY_SENDER', 'MAILBEEZ_BIRTHDAY_SENDER_NAME', 'MAILBEEZ_BIRTHDAY_SORT_ORDER');
    }
		
    function install() {
			mh_insert_config_value(array('configuration_title' => 'Send birthday reminder', 
																	 'configuration_key' => 'MAILBEEZ_BIRTHDAY_STATUS', 
																	 'configuration_value' => 'False', 
																	 'configuration_description' => 'Do you want to send  birthday emails?', 
																	 'set_function' => 'mh_cfg_select_option(array(\'True\', \'False\'), '
																	 ));
		
			mh_insert_config_value(array('configuration_title' => 'Set days before', 
																	 'configuration_key' => 'MAILBEEZ_BIRTHDAY_BEFORE_DAYS', 
																	 'configuration_value' => '1', 
																	 'configuration_description' => 'number of days before birthday sending the emails', 
																	 'set_function' => ''
																	 ));
																	 
			mh_insert_config_value(array('configuration_title' => 'Set days to skip after', 
																	 'configuration_key' => 'MAILBEEZ_BIRTHDAY_PASSED_DAYS_SKIP', 
																	 'configuration_value' => '2', 
																	 'configuration_description' => 'number of days after which do skip the birthday email (in case cron job failed)', 
																	 'set_function' => ''
																	 ));
		
			mh_insert_config_value(array('configuration_title' => 'sender email', 
																	 'configuration_key' => 'MAILBEEZ_BIRTHDAY_SENDER', 
																	 'configuration_value' => STORE_OWNER_EMAIL_ADDRESS, 
																	 'configuration_description' => 'sender email', 
																	 'set_function' => ''
																	 ));
																	 
			mh_insert_config_value(array('configuration_title' => 'sender name', 
																	 'configuration_key' => 'MAILBEEZ_BIRTHDAY_SENDER_NAME', 
																	 'configuration_value' => STORE_NAME, 
																	 'configuration_description' => 'sender email', 
																	 'set_function' => ''
																	 ));
																	 
																	 
			mh_insert_config_value(array('configuration_title' => 'Sort order of display.', 
																	 'configuration_key' => 'MAILBEEZ_BIRTHDAY_SORT_ORDER', 
																	 'configuration_value' => '20', 
																	 'configuration_description' => 'Sort order of display. Lowest is displayed first.', 
																	 'set_function' => ''
																	 ));
    }
  }
?>
When i sending my birthday mail, i want to insert the $dob value (it will be a 5 items code) in this mail in order to offer a reduction to my client

Your method is quiet to difficult for me ! lol
And don't forget i'm french ........ ;-)

#18   MailBeez

MailBeez
  • Partner
  • 237 posts
  • Real Name:Cord
  • Gender:Male
  • Location:Denmark

Posted 24 June 2010 - 09:35

try this:
(try to read and understand before copy&paste&complain ;-) )


<?php
// make it a function
function fharos_is_cool() {
  global $language; // you might need to define some globals
  $jour = date('j');
  $mois = date('m');
  if ($jour == 22 && $mois == 06) {
   $dob = "France will not win the Fifa World Cup......."; 
  } else {
   $dob = "Off course not !";
  }
  return $dob;
}
?>


<?php
/*
  MailBeez Automatic Trigger Email Campaigns
  (...)
*/
    
// include fharos file
require_once(DIR_FS_CATALOG. 'mailhive/mailbeez/email/coupon_dob.php' );

(...) // no changes
				
$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'],
'dob' => fharos_is_cool() // call the function, added to have field $dob to use in tpl.
);
(...)
?>

hope this helps, otherwise you first need to understand more about programming

#19   fharos

fharos
  • Members
  • 9 posts
  • Real Name:Rémy

Posted 24 June 2010 - 11:17

Thxs mailbeez,

I better understand the system with you now.
Unfortunately, even using it, it does not work.

$dob is appearing in the mail like this : "$dob" !!

I put my code below.
function getAudience() {
			global $languages_id;
			
      $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);
			
			// for early check
			$mb_chk = new mailbeez_mailer($this);						
			
			while ($item = mh_db_fetch_array($query)) {
			// mandatory fields:
			// - firstname
			// - lastname
			// - email_address
			// - customers-id -> block
			
			// other keys are replaced while sending: $<key>
			
				// early check to avoid processing when email was already sent
				$chk_result = $mb_chk->check($this->module, $this->iteration, $item['customers_id']);
				if ($chk_result != false) {
					// this iteration for this customer was already sent -> skip
					continue;
				}
				
				$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'],
																											 'dob' => fharos_is_cool()
																											 );
			}
			return $this->audience;
		}

After I lower my arms!
Thxs a lot for the help

Fharos

#20   fharos

fharos
  • Members
  • 9 posts
  • Real Name:Rémy

Posted 24 June 2010 - 11:24

After a check it's appear tha the $dob appearring only in the liste of customers !!!
Think the code in birthday.php is not in the right place.

still searching