Hi, Im the author of email templates plugin.
@mailgun could you please add a filter hook in your wp-mail-api.php file so I can replace the mail content with an HTML template ?
When used with SMTP it works fine because I hook into phpmailer at a later runtime, but for your http api that is enabled by default I don’t have a way to modify the message.
For your reference this is how I do it for phpmailer:
/**
* Modify php mailer body with final email
*
* @since 1.0.0
* @param object $phpmailer
*/
function send_email( &$phpmailer ) {
do_action( 'mailtpl/send_email', $phpmailer, $this );
$message = $this->add_template( apply_filters( 'mailtpl/email_content', $phpmailer->Body ) );
$phpmailer->AltBody = $this->replace_placeholders( strip_tags($phpmailer->Body) );
$phpmailer->Body = $this->replace_placeholders( $message );
}
Or how I do it for mandrill:
/**
* Mandrill Compatibility
* @param $message Array
*
* @return Array
*/
public function send_email_mandrill( $message ) {
do_action( 'mailtpl/send_email_mandrill', $message, $this );
$temp_message = $this->add_template( apply_filters( 'mailtpl/email_content', $message['html'] ) );
$message['html'] = $this->replace_placeholders( $temp_message );
return $message;
}
If you could provide a similar hook would be great so I can make both plugins compatibles. Like for example. I couldn’t find github for the plugin but if you add the following on line 328 will do the trick ( Just tested locally )
$body = apply_filters(‘mailgun_message_body’,$body);
Regards
-
This reply was modified 8 years, 1 month ago by
Damian. Reason: added code