# Overwrite new user email using html blade template

**URL:** https://discourse.roots.io/t/overwrite-new-user-email-using-html-blade-template/24836
**Category:** sage
**Created:** 2023-02-20T17:41:26Z
**Posts:** 9
**Showing post:** 2 of 9

## Post 2 by @strarsis — 2023-02-20T17:43:36Z

You use a hook for the custom mail HTML and render the template to a string and return it instead.

```
add_filter( 'wp_new_user_notification_email', 'custom_wp_new_user_notification_email', 10, 3 );

function custom_wp_new_user_notification_email( $wp_new_user_notification_email, $user, $blogname ) {
    $message = \App\template('emails/welcome', compact('user', 'blogname'));
    $wp_new_user_notification_email['message'] = $message;
    return $wp_new_user_notification_email;
}
```

In this (admittedly untested) example the blade template receives the `$user` and `$blogname` variables and the rendered template is used as the email message.

Is this a Sage 9 or Sage 10 theme ([Sage 10 template rendering](https://discourse.roots.io/t/sage-10-how-to-return-blade-templates-from-setup-php-for-custom-shortcodes/20538/2))?

---

_[View the full topic](https://discourse.roots.io/t/overwrite-new-user-email-using-html-blade-template/24836)._
