EmailStrategie
Categories
Component ID
2310617
Component name
EmailStrategie
Component type
module
Maintenance status
Development status
Component security advisory coverage
not-covered
Downloads
786
Component created
Component changed
Component body
EmailStrategie is a mailing and sms sending platform in SaaS, Webservice & API mode.
This module has been developed to use their services to send mails.
Requirements
This module is based on MailSystem module which to provide an API to specify either a modifier or a sender for mails.
In our case, this current module will be used both for the format and send through EmailStrategie webservices.
Features
- Create campaigns on the fly
- Can reuse an already generated campaign
- Send either plain or html mails
- Send attachments
- Send to multiple "to"
- Support for replacement in templated mails
- Support for Drupal native and SimpleNews sending mail
Installation and configuration
- Put the module in
sites/all/modulesfolder - Enable this module and MailSystem if not already done
- Specify EmailStrategieMailSystem as mail() method on
admin/config/system/mailsystemadministration page - Update
settings.phpfile adding following lines:
$conf['emailstrategie_login'] = 'your_own_login';
$conf['emailstrategie_password'] = 'your_digit_password';
$conf['emailstrategie_domain'] = 'your_domain'; // mu0t000.com
- Send mail from your module (sample code):
/**
* Sample callback function.
*/
function sample_module_callback() {
$from = 'admin@example.local';
$to = '"User 1" <user1@example.local>, user2@example.local';
$attachment = array(
'filecontent' => file_get_contents(DRUPAL_ROOT . '/README.txt'),
'filename' => 'README.txt',
'filemime' => 'text/plain',
);
$params = array(
'subject' => t('Sample mail subject'),
'body' => t('You are watching an email sent<br/>from my <strong>drupal</strong> website'),
'attachments' => array(
$attachment,
),
);
if (drupal_mail('sample_module', 'send_mail', $to, language_default(), $params, $from, TRUE)) {
drupal_set_message(t('Mail sent to %text', array('%text' => $to)));
}
else {
drupal_set_message('Mail not sent');
}
return '';
}
/**
* Implements hook_mail().
*/
function sample_module_mail($key, &$message, $params) {
$message['headers']['Content-Type'] = 'text/html; charset=UTF-8';
switch ($key) {
case 'send_mail':
$message['subject'] = $params['subject'];
$message['body'][] = $params['body'];
break;
}
}
Notes
Switch between text plain and text html formats is done using header content type.
Project status
This project is still in hard development. Currently it's not advised to it in production environment.
Don't hesitate to fork project or create issues with patch to contribute.
Disclaimer
This current work has no connection with the EmailStrategie company.
Credits
Original idea & sponsoring : Actualys
