在Laravel项目中,我无法从GoDaddy邮件帐户发送邮件。我已在文件中提供了所有需要的值,但邮件未发送。
这是我的.env
文件
MAIL_DRIVER=mail
MAIL_HOST=hostdetails
MAIL_PORT=465
MAIL_USERNAME=test@ezmoverandrental.com
MAIL_PASSWORD=testpass
MAIL_ENCRYPTION=ssl
控制器
public function estimation_form_submit_confirm()
{
Mail::send(new SendMail());
}
App / Mail / SendMail.php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Http\request;
class SendMail extends Mailable
{
use Queueable, SerializesModels;
public function __construct()
{
}
public function build(request $request)
{
return $this->view('mail',['name'=>'raff'])->to('support@gmail.com')->from('info@domainName.com');
}
}
log
文件中也未显示错误。
我还需要在其他地方更改代码!!!
有人帮助吗?
答案 0 :(得分:0)
================================================ ======================== 1.请使用php artisan config:clear或php artisan config:cache更新您的配置
注意:- 注意:关闭终端后,队列将停止工作。如果希望队列继续侦听,则可以在Linux终端中运行以下命令:
nohup php工匠队列:工作&
================================================ =======================
如果您要发送简单邮件,则可以无队列发送
Mail::send('auth.emails.verify', $data, function ($message) use ($data) {
$message->to($data['email'])
->subject('Verify your email address');
});
2. without a blade
Mail::send([], [], function ($message) use ($data) {
$message->to($data['email'])
->subject('Verify your email address')
->setBody('<h1>Verify Your Email Address</h1><p>You registration is successful verify your email before proceeding by clicking the link below. </p><p><a href="">Click here to activate your account .</a></p>', 'text/html');
});
3. Or simply text mail
Mail::raw('Your Text', function ($message) use ($data) {
$message->to($data['email'])
->subject('Verify your email address');
});