jeudi 6 juin 2019

How send email in Laravel 5.8

I am beginner in Laravel. I use Laravel 5.8 in my project. I want send email from contact form.

I have this code:

public function sendContactForm($request)
    {
        $this->validate($request, [
            'name' => 'required|string',
            'topic' => 'required|string',
            'email' => 'required|email',
            'message' => 'required|string',
            'captcha' => 'required|captcha',
            'acceptReg' => 'required|integer',
        ]);
        $adminEmail = $this->frontendRepository->getSystemAdminEmail();

        $title = $request->input('topic');
        $txt = nl2br($request->input('message'));
        $userName = $request->input('name');
        $email = $request->input('email');
        $ip = $request->getClientIp();
        $dateTime = date('Y-m-d H:i:s');

        $message = "Masz wiadomość ze strony". env('APP_NAME')."<br/>";
        $message .= "
        <b>Dane wiadomości:</b> $dateTime [$ip]<br/>
        <b>Tytuł wiadomości:</b> $title<br/>
        <b>Imię:</b> $userName<br/>
        <b>Adres email:</b> $email<br/>
        <b>Wiadomość:</b> $txt<br/>";  

        echo "XXXXX $adminEmail"; die();
    }

$adminEmail - this is my email

How can I send this message as email?



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/31ge0ua
via IFTTT

Aucun commentaire:

Enregistrer un commentaire