gpt4 book ai didi

php - Laravel 电子邮件未发送但没有错误,带有自己的 smtp 服务器

转载 作者:行者123 更新时间:2023-12-01 21:33:22 25 4
gpt4 key购买 nike

ISo 我有一个 SMTP 服务器随托管服务器一起提供,已经正确使用了主机、端口、用户名、密码等。电子邮件正在发送,但未返回任何错误。它在邮件陷阱中工作。我使用 beautymail 发送电子邮件。根据我的 cpanel 网站,配置是正确的。

我的.env

MAIL_DRIVER=smtp
MAIL_MAILER=smtp
MAIL_HOST=mail.(myweb).com
MAIL_PORT=465
MAIL_USERNAME=cs@(myweb).com
MAIL_PASSWORD=(mypass)
MAIL_FROM_ADDRESS=no-reply@(myweb).com
MAIL_FROM_NAME=(myname)
MAIL_ENCRYPTION=ssl

我的 mail.php 文件(可能有用?)

<?php

return [

/*
|--------------------------------------------------------------------------
| Default Mailer
|--------------------------------------------------------------------------
|
| This option controls the default mailer that is used to send any email
| messages sent by your application. Alternative mailers may be setup
| and used as needed; however, this mailer will be used by default.
|
*/

'default' => env('MAIL_MAILER', 'smtp'),

/*
|--------------------------------------------------------------------------
| Mailer Configurations
|--------------------------------------------------------------------------
|
| Here you may configure all of the mailers used by your application plus
| their respective settings. Several examples have been configured for
| you and you are free to add your own as your application requires.
|
| Laravel supports a variety of mail "transport" drivers to be used while
| sending an e-mail. You will specify which one you are using for your
| mailers below. You are free to add additional mailers as required.
|
| Supported: "smtp", "sendmail", "mailgun", "ses",
| "postmark", "log", "array"
|
*/

'mailers' => [
'smtp' => [
'transport' => 'smtp',
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'encryption' => env('MAIL_ENCRYPTION', null),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'timeout' => null,
],

'ses' => [
'transport' => 'ses',
],

'mailgun' => [
'transport' => 'mailgun',
],

'postmark' => [
'transport' => 'postmark',
],

'sendmail' => [
'transport' => 'sendmail',
'path' => '/usr/sbin/sendmail -bs',
],

'log' => [
'transport' => 'log',
'channel' => env('MAIL_LOG_CHANNEL'),
],

'array' => [
'transport' => 'array',
],
],

/*
|--------------------------------------------------------------------------
| Global "From" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to be sent from
| the same address. Here, you may specify a name and address that is
| used globally for all e-mails that are sent by your application.
|
*/

'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],

/*
|--------------------------------------------------------------------------
| Markdown Mail Settings
|--------------------------------------------------------------------------
|
| If you are using Markdown based email rendering, you may configure your
| theme and component paths here, allowing you to customize the design
| of the emails. Or, you may simply stick with the Laravel defaults!
|
*/

'markdown' => [
'theme' => 'default',

'paths' => [
resource_path('views/vendor/mail'),
],
],

];

一直在四处寻找,但没有对我有用,谢谢...

发件服务器 (SMTP):mail.(myweb).com端口:465

编辑:附加信息,当我在 outlook 中手动设置电子邮件时一切正常。电子邮件已发送,收件箱正常工作。下面的一些信息可能会有用

Username:   cs@(myweb).com
Password: Use the email account’s password.
Incoming Server: mail.(myweb).com
IMAP Port: 993 POP3 Port: 995

Outgoing Server: mail.(myweb).com
SMTP Port: 465

最佳答案

如果您使用的是安全邮件设置,那么试试这个

MAIL_DRIVER=smtp
MAIL_HOST=mail.(myweb).com //MAIL_HOST=myweb.com
MAIL_PORT=465
MAIL_USERNAME=cs@(myweb).com
MAIL_PASSWORD=(mypass)
MAIL_ENCRYPTION=ssl

不要忘记在 .env 中进行更改后清除配置缓存 config:clear

如果您的安全设置的外发邮件服务器仅为 myweb.com,那么您的 MAIL_HOST 将变为 MAIL_HOST=myewb.com其余设置没问题,但还要确保在收件箱中等待 10 到 15 分钟收到的邮件。

关于php - Laravel 电子邮件未发送但没有错误,带有自己的 smtp 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62309343/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com