Email HTML modification, how to add images

Hi,
I modified the email template via the child theme but the logos and images don’t show as I know these need to be saved somewhere. Is there a way to do this via the child theme modification?

As far as I know these images should also be registered as the email attachments, otherwise email service providers will reject them for security reasons. If you’re familiar with coding please check this solution wordpress - Display inline image attachments with wp_mail - Stack Overflow

hey! I am wondering how could you modify the email template via Child theme? I didn’t find any code related to the emails within the theme code and my email template doesn’t work appropriately if I just copy and paste into the email templates at Hivepress.

Hi,

If you need to overwrite template parts, please check this doc How to override template parts - HivePress Help Center

Also, you can check this doc How to customize emails - HivePress Help Center

​I hope this is helpful to you.

thank you so much for the quick help, there is one thing which makes me confused. I have override the email template, and everything I put there is displayed perfectly as it supposed in my emails, but whatever I put into emails from Wordpress dashboard let’s say Email Verification is not displayed correctly especially the css part.

Just to test this I have put everything for my email verification email into the email template part, and when my website sent this email it was displayed perfectly, when I removed the body part of this email and I added it to Hivepress email customization the body part wasn’t displayed properly. Any way you could help why this happens?

Hi,

Yes, WP editor can cut custom CSS, etc. We recommend overwriting the general email template part, and the emails themselves will only contain text content with basic formatting inside.

Thank you for your help! I am using this snippet now instead and it seems like this display emails perfectly!

add_filter( 'hivepress/v1/emails/user_email_verify', 'modify_hivepress_email_body', 10, 2 );

function modify_hivepress_email_body( $props, $email ) {
    // Modify the email subject
    if ( isset( $props['subject'] ) ) {
        $props['subject'] = 'New Subject Here';
    }

    // Modify the email body
    if ( isset( $props['body'] ) ) {
        $props['body'] = <<<HTML
        html code here
        HTML;
    }

    // Always return the modified props
    return $props;
}

2 Likes

Hi @0xfreelance can you please show me the steps you took to show this? do you have examples? were you able to get your logo in the email header for example?

Thanks!

Hi @rvmp.au!

I just uploaded my pictures to wp media uploads, and used tabular.email to create an email template, after that I removed the Hivepress email edits I previously used (through Wordpress dashboard) and just used this snippet to put my full template at the html code part.

This way my images are displayed and the template appears to be exactly the same as it was when I designed it.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.