I have to send some emails in a custom Drupal 7 module.
I'd like to use the PET module (Previewable email templates) to manage the templates and
drupal_mail() to send emails because it already uses SwiftMailer to send emails.
The problem is that the body of the email I get from Pet has some tokens that I should replace before the email is sent.
How can I replace them?
This is the code I'm using.
$pet = pet_load('test1'); $params['format']= "text/html"; $params['charset']= "UTF-8"; $params['email_subject']= $pet->subject; $params['email_body']=$pet->mail_body; ///$params['email_body']= <body with token replaced> drupal_mail('myLib', 'customNotifications', 'firstname.lastname@example.org', language_default(), $params);