0

This code delete the user and sends a message to him

public function deleteUser() {

    if (auth()) {

        $user = auth()->user();

        if ($user->delete()) {

            Mail::send('vendor.mail.html.message', [], function($m) use($user){

                $m->subject('Your account has been deleted');
                $m->to($user['email']);
                $m->setBody('<p>'.$user['name'].', Hope to see you again</p>', 'text/html');

            });
        }
    }
}

When you switch the line

Mail::send('vendor.mail.html.message', [], function($m) use($user)

With

Mail::send([], [], function($m) use($user)

The message is sent

Files

gms
  • 144
  • 1
  • 8
  • 1
    Hello, it is better in your case to use *Laravel Notification*, take a look to this : [Laravel Notification](https://laravel.com/docs/5.8/notifications) – sohaieb azaiez Jun 29 '19 at 19:22
  • and to be honest, your question is not clear , so if it's possible, you have to reformulate your problem here . – sohaieb azaiez Jun 29 '19 at 19:32
  • Are you getting any errors? Have you modified the `message.blade.php` template at all? Might be because your not providing the [`$slot`](https://github.com/laravel/framework/blob/e6c8aa0e39d8f91068ad1c299546536e9f25ef63/src/Illuminate/Mail/resources/views/html/message.blade.php#L10) value. – D Malan Jun 29 '19 at 20:14
  • Your issue almost definitely lies in message.blade.php if passing the template is what is causing it to not send – Giovanni S Jun 29 '19 at 20:19

0 Answers0