2 years ago

laravel how to send email on new user registration only to admin email

Posted 2 years ago by trakaismangusts

I need to send a notification email only to admin when new user is registered.

Now i dont get any errors, but emails not coming.

Here ir registration controller:

      protected function create(array $data)
    return User::create([
        'companyname' => $data['companyname'],
        'email' => $data['email'],
        'password' => bcrypt($data['password']),
        'VAT' => $data['VAT'],
        'companyphone' => $data['companyphone'],
        'companystreet' => $data['companystreet'],
        'companycity' => $data['companycity'],
        'companycountry' => $data['companycountry'],
        'companypostcode' => $data['companypostcode']
    Mail::send('newUser', function($message){
        $message->from('[email protected]');
        $message->to('[email protected]');

Here is Mail module :

    public function build()
    return $this->view('newUser');

I would be really happy if someone help me with this and explain how all this stuff works.

Please sign in or create an account to participate in this conversation.