Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
In ces_offerswants.install:
function mymodule_enable() {
$current = variable_get('mail_system', array('default-system' => 'DefaultMailSystem'));
$addition = array('mymodule' => 'MymoduleMailSystem');
variable_set('mail_system', array_merge($current, $addition));
}
function mymodule_disable() {
$mail_system = variable_get('mail_system', array('default-system' => 'DefaultMailSystem'));
unset($mail_system['mymodule']);
variable_set('mail_system', $mail_system);
}
(Needs in hook_update too, for sites in production)
In offerswants.module:
class MymoduleMailSystem extends DefaultMailSystem {
public function format(array $message) {
$message['body'] = implode("\n\n", $message['body']);
$message['body'] = drupal_wrap_mail($message['body']);
return $message;
}
}
(This is avoiding function html_to_text() in class DefaultMailSystem)
Comments
Comment #3
XaviP CreditAttribution: XaviP commentedWith this last commit, the module ces_offerswants sends emails with html tags.
In a live site, it needs to run update.php for updating email_system variable.
Still needs work for better layout in alert emails.
Comment #5
XaviP CreditAttribution: XaviP commentedComment #7
XaviP CreditAttribution: XaviP commentedCorrected typos in offers periodical email alert.
Marking as Fixed as it seems ok now. Please reopen if any problem.