welcome user email template in laravel 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
    $email_data = array(
        'name' => $data['name'],
        'email' => $data['email'],
    );

    // send email with the template
    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

Hello {{ $name }},<br><br>

Welcome to MyNotePaper.<br><br>

Thank You,<br>
MyNotepaper

Tags:

Php Example