admin管理员组文章数量:1336293
In my laravel app which actually sends me mails I cannot bring the email verification for user registration to work, the code runs through, I get no error, but also no email (to any address).
To mention in advance: Off course I could overwrite the methods to use Mail:: instead of ->notify(), but I really would like notify() to work correctly out of the box.
EDIT: I checked changing the smtp settings to a mailtrap server, and unfortunately the email is shown there, with 83.4% compatibility, no blacklisting of any kind... which really is a bummer, because it doesn't help me much...except perhaps to assume the issue is the smtp server, but why block notifications and let mails through remains a mistery...
2nd EDIT: I included smtp credentials of a complete different webhosting with the result, that notifications are bein sent now. I remain with the doubt what ->notify() is doing different than Mail:: or why one smtp server is stricter with notifications than with Mail::, what could be different
My daily cronjobs send me mails with:
Mail::to('[email protected]')->send(new CronSuccessful($body));
So I can safely assume, my mail config is correct and working. the emails do not land in the spam folder or anything like that and they are sent through smtp relay.
The email verification during registration uses this link in web.php :
Route::post('/email/verification-notification', function (Request $request) {
Log::debug('/email/verification-notification');
$request->user()->sendEmailVerificationNotification();
return back()->with('message', 'Verification link sent!');
})->middleware(['auth', 'throttle:6,1'])->name('verification.send');
and in the user.php which implements MustVerifyEmail, I even overwrote the sendVerificationNotification
public function sendEmailVerificationNotification()
{
Log::debug('User sendEmailVerificationNotification');
$this->notify(new VerifyEmail);
Log::debug('Mail sent supposedly');
}
I get these log entries, but no mail... SO my only assumption at the moment is that notify sends the email to an unknown place and I do not know where to read it or to configure that it uses normal mail smtp instead of an unknown channel.
[2024-11-19 14:53:53] DEBUG User->sendEmailVerificationNotification(67):
User sendEmailVerificationNotification[2024-11-19 14:53:54] DEBUG User->sendEmailVerificationNotification(69):
Mail sent supposedly
Any help on how to trace laravel notification setup? Or where I could configure that? Because these implementations are default laravel.
EDIT: I have temporarily switched the MAIL_MAILER to a dedicated log channel. the mail message appears and seems well formed (has from, to message, etc). Which leaves me with lesser options: from the lack of any answer of the smtp server I am close to assume the mail never leaves the localhost. any help on how to debug this? I meanwhile have also added eventListeners for MessageSending and MessageSent, but they help me neither, the event looks as it should
[2024-11-19 17:39:49] DEBUG SendingMailNotification->handle(20): array (
'level' => 'info',
'subject' => 'Verify Email Address',
'greeting' => NULL,
'salutation' => NULL,
'introLines' =>
array (
0 => 'Click the button below to verify your email address.',
),
'outroLines' =>
array (
),
'actionText' => 'Verify Email Address',
'actionUrl' => 'http://localhost:63347/email/verify/...',
'displayableActionUrl' => 'http://localhost:63347/email/verify/...',
'__laravel_notification_id' => 'ff0f2d89-e18d-4f88-84d0-289502132e11',
'__laravel_notification' => 'Illuminate\\Auth\\Notifications\\VerifyEmail',
'__laravel_notification_queued' => false,
'mailer' => 'smtp',
'message' =>
\Illuminate\Mail\Message::__set_state(array(
'message' =>
\Symfony\Component\Mime\Email::__set_state(array(
'message' => NULL,
'headers' =>
\Symfony\Component\Mime\Header\Headers::__set_state(array(
'headers' =>
array (
'from' =>
array (
0 =>
\Symfony\Component\Mime\Header\MailboxListHeader::__set_state(array(
'name' => 'From',
...
'addresses' =>
array (
0 =>
\Symfony\Component\Mime\Address::__set_state(array(
'address' => 'correct@emailaddress',
'name' => 'MY App Name',
)),
),
)),
),
'to' =>
array (
0 =>
\Symfony\Component\Mime\Header\MailboxListHeader::__set_state(array(
'name' => 'To',
...
'addresses' =>
array (
0 =>
\Symfony\Component\Mime\Address::__set_state(array(
'address' => '[email protected]',
'name' => '',
)),
),
)),
),
'subject' =>
array (
0 =>
...
'value' => 'Verify Email Address',
)),
),
),
'lineLength' => 76,
)),
'body' => NULL,
'text' => 'BOREALIS: http://localhost
...
</html>',
'htmlCharset' => 'utf-8',
'attachments' =>
array (
),
'cachedBody' => NULL,
)),
'embeddedFiles' =>
array (
),
)),
)
本文标签: notifylaravel 11 registration email verification not sending mailsStack Overflow
版权声明:本文标题:notify - laravel 11 registration email verification not sending mails - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742405941a2468821.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论