0

I am using the auth system that comes with laravel 5 and would like to send notification email after registration. I tried adding a method that sends email(and it works I tested) in postReigster method of AuthenticatesAndRegistersUsrers.php but it doesn't work.

Please help

The code I tried adding in registrar create and authandregister postRegister

   $email = EmailTemplate::all()->first();
        Mail::raw($email->topic, function($message) use ($data, $email)
        {

            $message->from($email->sender, $email->sender);

            $message->to($data->email);
        });
zarcel
  • 1,211
  • 2
  • 16
  • 35
  • what have you done so far ? please share the code. – mirza Apr 04 '15 at 12:19
  • I used the Mail::raw() method to test if postRegister is fired but it doesn't. All I need is where to put the method – zarcel Apr 04 '15 at 12:21
  • possible duplicate of [How to send mail after Laravel 5 default registration?](http://stackoverflow.com/questions/29173028/how-to-send-mail-after-laravel-5-default-registration) – Limon Monte Apr 04 '15 at 12:23

1 Answers1

0

You must add your code in this file:

/app/Services/Registrar.php

to this function before return you must add something like:

public function create(array $data)
{

 your_mail_function($data['email'], 'towhom', 'subject' );

    return User::create([
        'name' => $data['name'],
        'email' => $data['email'],
        'password' => bcrypt($data['password']),
    ]);
}
mirza
  • 5,685
  • 10
  • 43
  • 73