laravel 8 send welcome email after registration code example
Example 1: registration welcome email laravel
use Illuminate\Support\Facades\Mail;
protected function create(array $data)
{
$user = User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
]);
$email_data = array(
'name' => $data['name'],
'email' => $data['email'],
);
Mail::send('welcome_email', $email_data, function ($message) use ($email_data) {
$message->to($email_data['email'], $email_data['name'])
->subject('Welcome to MyNotePaper')
->from('[email protected]', 'MyNotePaper');
});
return $user;
}
Example 2: registration welcome email laravel
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=48664********
MAIL_PASSWORD=6cfa6********