I'm trying to send mail using Laravel. Here's my mail configuration in .env.
MAIL_DRIVER=smtp
MAIL_HOST=smtp.zoho.com
MAIL_PORT=465
MAIL_USERNAME=booking@bholebabatravels.com
MAIL_PASSWORD=xyzh
MAIL_ENCRYPTION=ssl
In my controller method:
Mail::send('Email.test', ['first_name' => $first_name, 'last_name' => $second_name, 'email' => $request->email, 'msg' => $msg, 'country' => $country, 'street' => $street_address], function ($message){
$message->to('malakar.rakesh1993@gmail.com')->subject('Booking Online!');
});
But I'm getting this error:
Connection could not be established with host smtp.zoho.com [A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. #10060]
I googled the problem but all I get is setting proper configuration and that's all. Configuration seems okay. What could be wrong?
答案 0 :(得分:0)
Laravel开箱即用hello@example.com
作为发件人地址。如果您不更改此值,您的电子邮件服务提供商很可能不会让您的电子邮件通过。
您可以在config/mail.php
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
答案 1 :(得分:0)
还应该确保MAIL_HOST应该正确。在我的情况下,Zoho帐户位于印度地区,因此我需要使用smtp.zoho.in而不是smtp.zoho.com