<p>I have done something very similar. You'll want to create a plugin for this. </p>

<p>In my case, I am validating email addresses so I was checking against the <code>onBeforeActivateUser</code> event. If you are not validating email addresses, @Lindsey D' answer is where you want to go.</p>

<p>Either way, they will look about like this:
I created a plugin called <code>accounts</code>.</p>

<p><strong>MyPlugin.php</strong></p>

<pre><code>public function init()
{
    /**
     * Event listener for activating a user.
     *
     * @param Event $event
     */
    craft()-&gt;on('users.onBeforeActivateUser', function (Event $event) {
        $user = $event-&gt;params['user'];

        craft()-&gt;accounts-&gt;onSendNotificationEmail($user);
    });
}
</code></pre>

<p><strong>MyService.php</strong></p>

<pre><code>/**
 * Sends a notification email.
 *
 * @param $user
 * @return bool
 */
public function onSendNotificationEmail($user)
{
    $recipient = $user-&gt;email; // get the email address passed in

    $email = new EmailModel();

    $message = '&lt;!DOCTYPE html&gt;&lt;html&gt;&lt;title&gt;My Title&lt;/title&gt;&lt;head&gt;';
    $message .= '&lt;body&gt;';
    $message .= '&lt;table width="800" border="0" cellpadding="0" cellspacing="0"&gt;';
    $message .= '&lt;tr&gt;&lt;td style="text-align: center;"&gt;LOGO/BRANDING &lt;/td&gt;&lt;/tr&gt;';
    $message .= '&lt;/table&gt;';
    $message .= '&lt;p&gt;Hello,&lt;br&gt;There has been a new account created on the website.&lt;/p&gt;';
    $message .= '&lt;p&gt;...your message here...&lt;/p&gt;';
    $message .= '&lt;/body&gt;&lt;/html&gt;';

    $email-&gt;subject = 'New Account Created';
    $email-&gt;body = $message;

    try {
        $email-&gt;toEmail = $recipient;

        craft()-&gt;email-&gt;sendEmail($email);
    } catch (\Exception $e) {
        return false;
    }
}
</code></pre>

<p>I'm sure there is a cleaner way to get your email body into the CP itself and allow the admin to change the message easily, but this works quick/well.</p>

CC BY-SA 3.0
2017-06-09T20:00:23.667Z
2017-06-10T05:23:29.930Z
2017-06-10T05:23:29.930Z
Damon
<p>I don't think a plugin is available to do this specifically but you could write your own plugin and listen to the <a href="https://craftcms.com/docs/plugins/events-reference#userGroups-onAssignUserToDefaultGroup" rel="nofollow noreferrer">onAssignUserToDefaultGroup</a> event and send an e-mail from there in your plugin.</p>

<p>Sending an e-mail can be done through the <a href="https://craftcms.com/classreference/services/EmailService" rel="nofollow noreferrer">EmailService</a></p>

CC BY-SA 3.0
2017-06-09T17:29:25.093Z
Great answer, although I think there may be a better event for this scenario. I'd personally use the [onSaveUser](https://craftcms.com/docs/plugins/events-reference#users-onSaveUser) event, and check against `isNewUser` before sending the email.
Lindsey D
CC BY-SA 3.0
2017-06-09T14:01:13.280Z
2017-06-09T14:01:13.280Z
Rias
<p>I have a client that wants to get notified whenever someone registers on their website. </p>

<p>How can I do this, is there some kind of plugin? If not how would I go about doing this?</p>

<plugins><emails><registration>
Send email to website owner after user registration
# Send email to website owner after user registration

(Asked by: username_0 on 2017-06-09)

I have a client that wants to get notified whenever someone registers on their website.

How can I do this, is there some kind of plugin? If not how would I go about doing this?

**Tags:** plugins, emails, registration

---

## 2 answers

### Answer by username_1 on 2017-06-09. Score: 4 | Accepted answer

I have done something very similar. You'll want to create a plugin for this. 
In my case, I am validating email addresses so I was checking against the onBeforeActivateUser event. If you are not validating email addresses, @Lindsey D' answer is where you want to go.
Either way, they will look about like this:
I created a plugin called accounts.
MyPlugin.php
public function init()
{
    /**
     * Event listener for activating a user.
     *
     * @param Event $event
     */
    craft()->on('users.onBeforeActivateUser', function (Event $event) {
        $user = $event->params['user'];

        craft()->accounts->onSendNotificationEmail($user);
    });
}

MyService.php
/**
 * Sends a notification email.
 *
 * @param $user
 * @return bool
 */
public function onSendNotificationEmail($user)
{
    $recipient = $user->email; // get the email address passed in

    $email = new EmailModel();

    $message = 'My Title';
    $message .= '';
    $message .= '';
    $message .= 'LOGO/BRANDING ';
    $message .= '';
    $message .= 'Hello,There has been a new account created on the website.';
    $message .= '...your message here...';
    $message .= '';

    $email->subject = 'New Account Created';
    $email->body = $message;

    try {
        $email->toEmail = $recipient;

        craft()->email->sendEmail($email);
    } catch (\Exception $e) {
        return false;
    }
}

I'm sure there is a cleaner way to get your email body into the CP itself and allow the admin to change the message easily, but this works quick/well.


---

### Answer by username_2 on 2017-06-09. Score: 2

I don't think a plugin is available to do this specifically but you could write your own plugin and listen to the [onAssignUserToDefaultGroup](https://craftcms.com/docs/plugins/events-reference#userGroups-onAssignUserToDefaultGroup) event and send an e-mail from there in your plugin.

Sending an e-mail can be done through the [EmailService](https://craftcms.com/classreference/services/EmailService)

> **Comments:**
> **username_3**: Great answer, although I think there may be a better event for this scenario. I'd personally use the [onSaveUser](https://craftcms.com/docs/plugins/events-reference#users-onSaveUser) event, and check against `isNewUser` before sending the email.  

---

