# Add HTML in emails

**URL:** <https://community.hivepress.io/t/add-html-in-emails/15744>\
**Category:** HivePress\
**Created:** [May 2, 2025, 5:12pm UTC](https://community.hivepress.io/t/add-html-in-emails/15744 "2025-05-02T17:12:08Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![lolofora](https://community.hivepress.io/letter_avatar_proxy/v4/letter/l/c2a13f/32.png) [@lolofora](https://community.hivepress.io/u/lolofora)\
**Post date:** [May 2, 2025, 5:12pm UTC](https://community.hivepress.io/t/add-html-in-emails/15744/1 "2025-05-02T17:12:08Z")

</div>

Hello everybody,

Notifications emails from the plugins :  
hivepress-requests - marketplace

/wp-content/plugins/hivepress-marketplace/includes/emails/class-order-dispute.php

Do not fully accepy html and spécial characters in subject.

Can can we make it so ?

This is the code of the file :

```auto
<?php
/**
 * Order dispute email.
 *
 * @package HivePress\Emails
 */

namespace HivePress\Emails;

use HivePress\Helpers as hp;

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;

/**
 * Order dispute email class.
 *
 * @class Order_Dispute
 */
class Order_Dispute extends Email {

	/**
	 * Class constructor.
	 *
	 * @param array $args Email arguments.
	 */
public function __construct( $args = [] ) {
    $args = hp\merge_arrays(
        [
            'subject' => esc_html__( 'MySmartisan - R&eacute;clamation ouverte', 'hivepress-marketplace' ), // Use actual character
            'body' => hp\sanitize_html( __( 
                '<html>
                <head>
                </head>
                <body>
                <p>Bonjour,</p>
                <p>Une r&eacute;clamation a &eacute;t&eacute; ouverte sur la commande <strong>n&deg;%order_number%</strong>.</p>
                <p><strong>D&eacute;tails de la commande :</strong><br>
                <a href="%order_url%">Acc&eacute;der &agrave; la fiche de la commande</a></p>
                <p><strong>Motif d&eacute;clar&eacute; :</strong><br>%dispute_details%</p>
                <p>Merci de prendre connaissance de cette r&eacute;clamation et de proc&eacute;der &agrave; son traitement dans les plus brefs d&eacute;lais.</p>
                </body>
                </html>', 
                'hivepress-requests' 
            ) ),
        ],
        $args
    );
    parent::__construct( $args );
}
}

```

I’d like at least the

tags to work and i need accents in the subject.

Thanks in advance 🙂

---

<div class="post-metadata">

**Author:** ![andrii](https://community.hivepress.io/user_avatar/community.hivepress.io/andrii/32/2951_2.png) [@andrii](https://community.hivepress.io/u/andrii)\
**Post date:** [May 5, 2025, 9:37am UTC](https://community.hivepress.io/t/add-html-in-emails/15744/4 "2025-05-05T09:37:20Z")

</div>

Hi,

Please note that you need to add code only using this documentation [How to add custom code snippets - HivePress Help Center](https://help.hivepress.io/article/23-how-to-add-custom-code-snippets). If you edit the code directly, the update from our side will overwrite these changes and the ones that will be by default. As for emails, you need to overwrite them in HivePress \> Emails using this documentation [How to customize emails - HivePress Help Center](https://help.hivepress.io/article/125-how-to-customize-emails). There, you can switch to the Code editor and add HTML.

I hope it helps

---

<div class="post-metadata">

**Author:** ![lolofora](https://community.hivepress.io/letter_avatar_proxy/v4/letter/l/c2a13f/32.png) [@lolofora](https://community.hivepress.io/u/lolofora)\
**Post date:** [May 5, 2025, 10:30am UTC](https://community.hivepress.io/t/add-html-in-emails/15744/5 "2025-05-05T10:30:29Z")

</div>

Hi Andrii,

Thank you for your reply but this is not helpfull at all.

The mail i am refering too do not exist in the  
Hivepress-\>email template.

There is a template for “order reject”  
but not for “order dispute”

It is hardcoded in that file :

/wp-content/plugins/hivepress-marketplace/includes/emails/class-order-dispute.php

This is the content of the original file :

```auto
<?php
/**
 * Order dispute email.
 *
 * @package HivePress\Emails
 */

namespace HivePress\Emails;

use HivePress\Helpers as hp;

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;

/**
 * Order dispute email class.
 *
 * @class Order_Dispute
 */
class Order_Dispute extends Email {

	/**
	 * Class constructor.
	 *
	 * @param array $args Email arguments.
	 */
	public function __construct( $args = [] ) {
		$args = hp\merge_arrays(
			[
				'subject' => esc_html__( 'Order Disputed', 'hivepress-marketplace' ),
				'body' => hp\sanitize_html( __( 'Order %order_number% %order_url% has been disputed with the following details: %dispute_details%', 'hivepress-marketplace' ) ),
			],
			$args
		);

		parent::__construct( $args );
	}
}

```

 ![hivepress-mail-html-bug-02](https://community.hivepress.io/uploads/default/original/2X/c/cb141efda6726b21966444de577ba739b4a27d98.jpeg)

Hence my problem, that is why i tried to change the php file.

But if you can guide me on how to make that template available in the wordpress/hivepress admin i’d be delighted 🙂

Thanks  
lolo

---

<div class="post-metadata">

**Author:** ![ihor](https://community.hivepress.io/user_avatar/community.hivepress.io/ihor/32/5_2.png) [@ihor](https://community.hivepress.io/u/ihor)\
**Post date:** [May 6, 2025, 8:45pm UTC](https://community.hivepress.io/t/add-html-in-emails/15744/7 "2025-05-06T20:45:07Z")

</div>

Hi,

Thanks for the details. Admin emails are not available in HivePress/Emails for editing, but it’s still possible to override them using external code snippets without editing the email file directly, please try using this code snippet:

```auto
add_filter(
	'hivepress/v1/emails/order_dispute',
	function ( $email ) {
		$email['subject'] = 'custom text or HTML';
		$email['body'] = 'custom text or HTML';

		return $email;
	}
);

```

Hope this helps

---

<div class="post-metadata">

**Author:** ![lolofora](https://community.hivepress.io/letter_avatar_proxy/v4/letter/l/c2a13f/32.png) [@lolofora](https://community.hivepress.io/u/lolofora)\
**Post date:** [May 6, 2025, 11:24pm UTC](https://community.hivepress.io/t/add-html-in-emails/15744/8 "2025-05-06T23:24:10Z")

</div>

Hi ihor,

Awesome thank you very much that is perfect ! 🙂

And for :

\wp-content\plugins\hivepress-requests\includes\emails\class-offer-submit.php

Would it be :

```auto
add_filter(
	'hivepress/v1/emails/offer_submit',
	function ( $email ) {
		$email['subject'] = 'custom text or HTML';
		$email['body'] = 'custom text or HTML';

		return $email;
	}
);

```

?

Thank you 🙂

lolo

---

<div class="post-metadata">

**Author:** ![ihor](https://community.hivepress.io/user_avatar/community.hivepress.io/ihor/32/5_2.png) [@ihor](https://community.hivepress.io/u/ihor)\
**Post date:** [May 7, 2025, 10:22am UTC](https://community.hivepress.io/t/add-html-in-emails/15744/10 "2025-05-07T10:22:53Z")

</div>

No worries, I’m glad I could help. Yes, the same code snippet, but with the “offer\_submit” email name should do the trick.

---

<div class="post-metadata">

**Author:** ![lolofora](https://community.hivepress.io/letter_avatar_proxy/v4/letter/l/c2a13f/32.png) [@lolofora](https://community.hivepress.io/u/lolofora)\
**Post date:** [May 7, 2025, 5:04pm UTC](https://community.hivepress.io/t/add-html-in-emails/15744/11 "2025-05-07T17:04:38Z")

</div>

Thank you ! 🙂

---

<div class="post-metadata">

**Author:** ![system](https://community.hivepress.io/user_avatar/community.hivepress.io/system/32/13990_2.png) [@system](https://community.hivepress.io/u/system)\
**Post date:** [June 6, 2025, 5:05pm UTC](https://community.hivepress.io/t/add-html-in-emails/15744/12 "2025-06-06T17:05:24Z")

</div>

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