简体   繁体   中英

Laravel 5.2 : send email via mail DERVER

I trying to send email from my laravel 5.2 app but never received the email in my inbox

here what I did

env

MAIL_DRIVER=mail
MAIL_HOST=myhosting.com
MAIL_PORT=587
MAIL_USERNAME=yousef@hosting.com
MAIL_PASSWORD=myPassword
MAIL_ENCRYPTION=tls

Controller

public function html_email(){
        $data = array('name'=>"Data Technology");
        Mail::send('emails.websitePriceRequest', $data, function($message) {
            $message->to('johnef_sh@hotmail.com', 'Data Technology')->subject
            ('Laravel HTML Testing Mail');
            $message->from('johnef_sh@hotmail.com','Data Technology');
        });
        echo "HTML Email Sent. Check your inbox.";
    }

after sending the email I get HTML Email Sent. Check your inbox.

but after checking my email noting is there

Try this

$view = 'emails.websitePriceRequest';
$subject = 'Laravel HTML Testing Mail';
$data = array('name'=>"Data Technology");
$email = 'johnef_sh@hotmail.com';
\Mail::send($view, $data, function($message) use($email, $subject)
{
    $message->from('johnef_sh@hotmail.com','Data Technology');
    $message->to($email)->subject($subject);
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM