Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Last active June 23, 2017 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Shelob9/6a4fdbb9a4cb8335d356dbf9836045fc to your computer and use it in GitHub Desktop.
Save Shelob9/6a4fdbb9a4cb8335d356dbf9836045fc to your computer and use it in GitHub Desktop.
<?php
/**
* Use a custom HTML file for your Caldera Forms email.
*/
add_filter( 'caldera_forms_mailer', function ( $mail, $data, $form ) {
//MAKE SURE TO CHANGE FORM ID
if ( 'CF1243..' == $form[ 'ID' ] ) {
ob_start();
//MAKE SURE TO CHANGE THIS TO YOUR FILE PATH
//BTW - You have all submission data in $data if you want to use in your html file
include '/path_to_file.html';
$html = ob_get_clean();
//Optional - Substitute Caldera Forms magic tags.
$html = Caldera_Forms::do_magic_tags( $html );
$mail[ 'message' ] = $html;
}
return $mail;
}, 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment