Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Mailgun

    (@mailgun)

    Hi there @will.lawrence! There should be checks in place to keep this from happening – what version of our plugin are you using? Also, are you using SMTP or the API for mail sending?

    • This reply was modified 8 years, 1 month ago by Mailgun.

    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
    Plugin Author Mailgun

    (@mailgun)

    @timersys I am adding two hooks mg_mutate_message_body and mg_mutate_attachments that you can use. They will be available with the 1.5.8.2 release. Hope this helps!

    Damian

    (@timersys)

    Thanks! Would be great if you can paste the functions here or point me to dev version so I can take a look and test it.

    Regards

    Plugin Author Mailgun

    (@mailgun)

    @timersys I wrote about it in the readme and you can see the actual hooks in wp-mail-api.php. Hope this helps!

    Damian

    (@timersys)

    Sure! I didn’t know you had github or I would created a PR to save some time.

    Thanks again

    Plugin Author Mailgun

    (@mailgun)

    @timersys Of course, thanks for the feedback!

    dalea

    (@dalea)

    I am having the same issue, with Mailgun activated the password reset email is coming through with the link missing.

    With Mailgun deactivated and the Email Template plugin running the reset email is received correctly formatted and nicely styled.

    Although this works we still need Mailgun functioning for other WordPress functions.

    I see from the comments above changes are needed for the Email Template plugin, have these been done and can I help in any way?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Mailgun emails sending as plain text’ is closed to new replies.