Html Emails support
-
Hi, Im the plugin author of email templates plugin.
Could you please add a filter hook in your plugin so I can replace the mail content with an HTML template ?
For your reference this is how I do regular 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 ); }
But it seems that you create a new instance of phpmailer instead of using existing one, so that is not working. A hook will solve this.
Other plugins like mailgun or mandrill that uses their own functions or API have hooks to modify the html and I do something like this:
/** * 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; }
A couple of your users will be happy to make both plugins works together. Thanks!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Html Emails support’ is closed to new replies.