Yes, there is a filter for this.
The correct filter is wp_mail
and is defined in /wp-includes/pluggable.php Line 135
So the code (maybe in your functions.php) should look something like this:
function mail_template($args){
ob_start();
require_once (get_template_directory() . '/mail-templates/contacemail.php');
$args['message'] = ob_get_contents();
ob_end_clean();
return $args;
}
add_filter('wp_mail', 'mail_template');
Related Posts:
- Pass info from functions.php to plugin
- Unpublished Pages Failing To Appear On Custom Path
- Plugin function in child theme
- Use action, filter, or hook to append HTML to WordPress plugin function
- add query string to all pages after user logged in
- How to Add Extra Text In WordPress Title Before Post Publish
- Passing a parameter to filter and action functions
- Get a list of all registered actions
- How can I edit post data before it is saved?
- How to only hook on Single.php after content?
- How To Determine If A Filter Is Called In A Sidebar/Widget Context?
- Customizing subject in comment notification e-mails
- Edit plugin without hooks in functions.php
- WP showing “warning: call_user_func_array()”, What to do?
- Filter Hook on plugin update
- Seeking clarification on page request life-cycle
- Removing user contact methods works from functions.php but not from a plugin
- Hide WordPress Plugin Deactivation Links
- Use external link in the add sub menu
- Pass A Value From Outside To A Plugin Variable
- Failed to invoke other hook from the init hook
- Does the ‘nav_menu_css_class’ filter accept 2 or 3 arguments?
- do_action and hook methods
- How can I filter blog name?
- why does the add_action(‘the_content’) overwrite my page
- Fatal error: Class not found in
- How to filter content post only on save
- Filter or action hook to insert content on admin pages before tag
- plugin_action_links_{$plugin_file} hook not in the main plugin file
- Over write plugin templates
- Woocommerce Shipping module available only for type of products [closed]
- How to find out what blocks are added by a plugin
- Determine plugin name from within plugin_action_links filter
- merging an array to an existing array using add_filter
- Placement of Code in Plugin for hooking `save_post`
- Reposition Woocommerce Message
- WP Job Manager Category Drop-down; Change Placeholder Text Via Filter
- Randomize attachment IDs
- add_query_arg not working
- Change permalink structure hidden button edit
- How do action and filter hooks understand where to look for the core function that we hooked our function to them
- How to append to title via functions.php for auto-posting plugin [duplicate]
- Inserting above the comment template
- Modifying the comments section through a plugin regardless of theme
- Using a post-signup hook to get user details
- Calling plugin function inside custom plugin for onclick event
- get current date + 90 days and checking every day
- Get Time Taken By Each Action Hook in WordPress
- Filtering WooCommerce Orders by Category
- Redirect to another page using contact form 7? [closed]
- Template filter for custom taxonomy terms
- Add sub menu page in your plugin
- Check if variable is set in filter
- What exactly happens to function argument availability when using a filter?
- Passing stored variables to add_filter
- Create a post builder skin in a plugin
- remove_action not removing add_action from constructor
- Plugin Development – Functions or Hooks?
- Are there action hooks for comments?
- How to use the pre_option filter before a plugin loads?
- How to use filter to disable adding a product to wishlist?
- WordPress: Add custom add_filter for custom functions
- How to remove a class function from a plugin by using remove_action()?
- Add action to custom Function
- How to hook into action/filter call
- Build a must-use plugin that tracks when other plugins are activated or deactivated
- Use a hook or filter, or overwrite this Gamipress function?
- Add hook after content without formatting
- How to convert Currency from USD to other IP Based currency in Php function
- WordPress Custom Hook with Class method
- Alternative Hook to the_content for Changing Background Color
- add a hook of Woocommerce to a plugin but it only shows and doesn’t function properly
- Randomize post (and page) IDs on generation
- The function called on the wp head hook becomes null
- ACF Fields are not showing up on Homepage
- front end editor creation for Restropress plug in – displaying information from a WP admin area, on a different URL
- How to Unhook actions/filters in within Class in plugin
- Modify function output in a plugin
- Override filter variable not working
- Customize plugin templates
- WordPress Add advertising ads befor and after content with periority [closed]
- plugin not hooking to my custom hook
- Why can’t I shove an instance of a class into a variable from a do_action hook?
- Passing a parameter to filter and action functions
- change output location of plugin function using a custom hook
- making a glossary with wordpress
- functions.php conditional output for a single plugin
- WP Members additional fields on user profile [closed]
- Order shipped by which driver[hook for woocoomerce order staus changed and popup in admin panel ] [closed]
- How often should I execute add_filter and function declaration in Code Snippets?
- filter just a portion of plugin function
- Change social icon in twenty twenty three theme
- Registering Class methods as hook callbacks
- Can I hook into get_avatar to supply a hash instead of an email?
- Bootstrap Drop Down menu is not working
- Show media-uploads to all users
- WP Function does not trigger on Webhook API Call
- Edit plugin’s HTML output with Hooks
- Show custom taxonomy in theme
- WordPress plugin add_filter returning a link does not work. What is the correct way?