How to send email without a view

Asked

Viewed 200 times

1

All tutorials I think about, including the official documentation show how to send emails using views.

How to send emails without any view? As a system routine automatically?

2 answers

0

public function email()
{
    Mail::send([], [], function ($message)
    {
        $message->to('[email protected]')
            ->subject('EMAIL TESTE AUTOMÁTICO')
            ->setBody('CORPO DA MENSAGEM DE EMAIL TESTE!!!');
    });
    return "email enviado";
}

0

The correct in this case would be to use the method raw and not the send

Mail::raw('CORPO DA MENSAGEM DE EMAIL TESTE!!!', function ($message) {
    $message->to('[email protected]')
        ->subject('EMAIL TESTE AUTOMÁTICO')        
});

See on documentation.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.