How to create an HTML-only report using the Pro Reports extension

In this tutorial, we will quickly go over how to create a Pro Reports report using only the email body and how to skip attaching the PDF to the email.

Inspiration came from this Facebook discussion in Admin Bar group, where one MainWP user shared their HTML template and where other expressed a desire for a simple HTML only report.

Pro Reports extension was designed to have the report data in the PDF attachment. So for this purpose, we will use a code snippet to disable the PDF creation and send only HTML report.

To do this,

1. Copy the snippet

add_filter( 'mainwp_pro_reports_email_attachments', 'mycustom_mainwp_pro_reports_email_attachments', 10, 4 );
function mycustom_mainwp_pro_reports_email_attachments( $attachments, $html_to_pdf, $report, $site_id = false ) {
return '';
}

2. Paste the code into the PHP tab
3. Click save

With the PDF now disabled, let’s move on to the email template.

We have prepared a ready-to-use template, which you can find in the knowledge-base article linked in the video description.
It’s fully written in HTML so customization should be easy. Before use, be sure to change the URL of the logo which will be shown in the email body and if needed adjust colors to reflect your company brand.

Let’s start

1. Download the template from here (external Dropbox link) and place it in /wp-content/uploads/mainwp/report-email-templates directory.
(once uploaded, the template will be available in the Report template dropdown)
2. Now, go to the MainWP Dashboard > Clients > Pro Reports and go to the Create Report tab
3. In the Report Settings section
4. Enter the Report title
5. In the Report type dropdown, choose One-time
6. In the Report date range, pick the starting and ending dates for the report
7. Enter the Send email from data (In most cases, your email address and name)
8. Enter the Send email to data (in most cases, your client email address and name. Tokens are allowed here and can be left at their default values, [client.email] and [client.name] if they have been set on the Client page or in Site settings)
9. Optionally, enter the Reply-to email and information
10. Enter the Email subject
11. Enter the Email message
12. Select Email template you uploaded earlier
13. Select the wanted site(s) in the Metabox on the right
14. Once you are sure that the report is ready and want to send it, click the Send Now button

And that’s it!