![](/img/trans.png)
[英]mailtrap: sending mail using mailtrap in laravel but it deliver in different mailtrap account
[英]Laravel not sending mail to mailtrap inbox
我曾尝试在 laravel 中使用 sendmail 但它没有用。 在此处查看我的帖子通过 Laravel 发送邮件不一致
所以,我尝试在 Laravel 中使用 mailtrap 的假 smtp 服务器。 它在这里也不起作用。 我在 Bitnami Mamp 堆栈 7.1.15-0、Laravel 5.8 上并在本地进行测试。
我按照这篇文章来设置我的代码
https://blog.mailtrap.io/send-email-in-laravel/
我在 mailtrap 中创建了一个免费帐户。 https://mailtrap.io/inboxes
这是我在 .env 文件中的配置
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=<myusername>
MAIL_PASSWORD=<mypassword>
MAIL_FROM_ADDRESS=from@example.com
MAIL_FROM_NAME=Example
我的mail.php 与默认配置保持一致。
我的可邮寄类 (ReminderMail.php) 的构建功能
public function build()
{
Log::info("Building the mailable class");
return $this->from('mail@example.com', 'Mailtrap')
->subject('Mailtrap Confirmation')
->markdown('emails.reminder')
->with([
'name' => 'New Mailtrap User',
'link' => 'https://mailtrap.io/inboxes'
]);
}
我的客户代码
echo "\n before sending mail";
\Mail::to('newuser@example.com')->send(new \App\Mail\ReminderMail());
echo "\n Mail sent";
我的回声打印正常。
我的电子邮件/reminder.blade.php 文件
@component('mail::message')
Hello **{{$name}}**, {{-- use double space for line break --}}
Thank you for choosing Mailtrap!
Click below to start working right now
@component('mail::button', ['url' => $link])
Go to your inbox
@endcomponent
Sincerely,
Mailtrap team.
@endcomponent
但是我仍然没有在我的 mailtrap 收件箱中收到邮件。
此致,
索拉夫
这可能是cache
的问题。 跑:
php artisan config:cache
这将再次清除并配置您的缓存。 然后再次尝试发送电子邮件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.