Custom email style

This documentation page is for Quform version 1 and may not be applicable for Quform 2 click here to visit the documentation for Quform 2.

This guide will show you how to modify the styles of the default notification email.

Step 1

Create a file name email-content.php then download and open the Quform plugin file iphorm-form-builder/includes/emails/email-html.php and copy the contents of the email-html.php file into email-content.php.

Step 2

Modify the inline CSS styles in the email-content.php file to suit. If you want to make the Label and Value on separate rows to improve the layout, add this code between lines 24 and 25:

1
</tr><tr>
</tr><tr>

Step 3

Add the following code to your theme functions.php file (or create a plugin for it).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function my_custom_email($mailer, $form, $attachments)
{
    // Get the new email content from the file email-content.php
    ob_start();
    include dirname(__FILE__) . '/email-content.php';
    $content = ob_get_clean();
 
    // Set the email content
    $mailer->msgHTML($content);
 
    // You must return the $mailer object
    return $mailer;
}
add_filter('iphorm_pre_send_notification_email', 'my_custom_email', 10, 3);
function my_custom_email($mailer, $form, $attachments)
{
    // Get the new email content from the file email-content.php
    ob_start();
    include dirname(__FILE__) . '/email-content.php';
    $content = ob_get_clean();

    // Set the email content
    $mailer->msgHTML($content);

    // You must return the $mailer object
    return $mailer;
}
add_filter('iphorm_pre_send_notification_email', 'my_custom_email', 10, 3);

Step 4

Upload the change to your theme functions.php file (or your custom plugin file) and upload the email-content.php file to the same folder as the file with the code from Step 3. If you created a plugin for this code, you can now Activate it on the Plugins page.

Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy