Customizing emails sent by Entry notes

GravityView allows you to display, add, and delete entry notes from the front end of your website. 

You can also email a copy of the recently-added note to another person:

Dropdown option selected for emailing a note; options include email addresses and adding a new address

Customized email form with user, email selection, and subject fields

Here's how that email (from the example above) will look:

Email from GravityView with subject and body text, including a URL link for viewing entry details

Let's say we want to make the note body more noticeable. Let's wrap the body message with an H2 tag. Here's the code to do that:

add_filter( 'gravityview/field/notes/email_content', 'gv_modify_notes_email_content', 10, 4 );

function gv_modify_notes_email_content( $email_settings ) {

extract( $email_settings );

$email_settings['message'] = '<h2>'.$message.'</h2>';

return $email_settings;

}

Finally, here is how the emails will look after our little customization:

Email showing a note with subject, body, and link sent from GravityView website

Neat, isn't it? Here are the other variables needed to modify all the other entry note email attributes:

add_filter( 'gravityview/field/notes/email_content', 'gv_modify_notes_email_content', 10, 4 );

function gv_modify_notes_email_content( $email_settings ) {

extract( $email_settings );

$email_settings['from'] = $from; //[email protected]

$email_settings['to'] = $to; //[email protected]

$email_settings['bcc'] $bcc; //[email protected]

$email_settings['reply_to'] = $reply_to; //[email protected]

$email_settings['subject'] = $subject; //subject of the email

$email_settings['message'] = $message; //body of the email (already in HTML format)

$email_settings['from_name'] = $from_name; //Example: GravityView Website

$email_settings['message_format'] = $message_format; //html

$email_settings['email_footer'] = $email_footer; //The text: This note was sent from {url}

return $email_settings;

}

Read here how to add these code samples to your website: Where to put code samples.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us