英文:
stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:0A00010B:SSL routines::wrong version number
问题
我对Laravel不熟悉;
我尝试使用Mailtrap发送重设密码邮件,但在尝试时出现以下错误:
“无法与主机建立连接“ssl://sandbox.smtp.mailtrap.io:465”:stream_socket_client():SSL操作失败,代码为1。 OpenSSL错误消息:error:0A00010B:SSL例程::错误的版本号”
这是我的.env文件:
MAIL_MAILER=smtp
MAIL_HOST=sandbox.smtp.mailtrap.io
MAIL_PORT=465
MAIL_USERNAME=454d94****52fa
MAIL_PASSWORD=991eae****e5b5
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
- 我收到了来自Mailtrap的新用户名和密码
- 我尝试了所有4个可用端口
- 我用另一个Google帐户登录到mailtrap并尝试使用新的用户名和密码
我尝试了所有这些方法,但仍然遇到此错误
英文:
I'm new to Laravel;
I'm trying to send reset password email with Mailtrap, bun when I try it, I got this error:
Connection could not be established with host "ssl://sandbox.smtp.mailtrap.io:465": stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:0A00010B:SSL routines::wrong version number
this is my .env file:
MAIL_MAILER=smtp
MAIL_HOST=sandbox.smtp.mailtrap.io
MAIL_PORT=465
MAIL_USERNAME=454d94****52fa
MAIL_PASSWORD=991eae****e5b5
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
- I received a new username and password from Mailtrap
- I tried with all 4 available ports
- I logged in with another google account to mailtrap and try it with new username and password
I tried all these things but still got this error
答案1
得分: 0
我在两天后成功解决了这个问题!
问题源自Mailtrap。
一旦我在本地安装了mailpit包,我就能轻松收到恢复邮件。
英文:
I was able to solve the problem after two days!
The problem was from Mailtrap
Once I installed the mailpit package on localhost, I was able to receive the recovery email easily
答案2
得分: 0
短回答:
在使用端口465的sandbox.smtp.mailtrap.io时,请使用MAIL_ENCRYPTION=starttls
。
长回答:
SMTP上的端口465通常是SMTP over TLS,这意味着MAIL_ENCRYPTION应该设置为tls。
然而,如果你运行
openssl s_client sandbox.smtp.mailtrap.io:465
你可以看到Mailtrap并没有按照这种方式配置这个端口。它配置为运行纯粹的SMTP,你可以使用STARTTLS命令升级为加密连接。
我相信这个完整的配置对你有用:
MAIL_MAILER=smtp
MAIL_HOST=sandbox.smtp.mailtrap.io
MAIL_PORT=465
MAIL_USERNAME=454d94****52fa
MAIL_PASSWORD=991eae****e5b5
MAIL_ENCRYPTION=starttls
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
披露:我在Mailosaur工作,这是与Mailtrap类似的服务。
英文:
short answer:
use MAIL_ENCRYPTION=starttls
when using sandbox.smtp.mailtrap.io on port 465
long answer:
Port 465 on SMTP is normally SMTP over TLS which means MAIL_ENCRYPTION should be set to tls.
However, if you run
openssl s_client sandbox.smtp.mailtrap.io:465
you can tell that this is not how Mailtrap has configured this port. It's configured to run plain SMTP which you can upgrade to an encrypted connection using the STARTTLS command.
I believe this full config should work for you:
MAIL_MAILER=smtp
MAIL_HOST=sandbox.smtp.mailtrap.io
MAIL_PORT=465
MAIL_USERNAME=454d94****52fa
MAIL_PASSWORD=991eae****e5b5
MAIL_ENCRYPTION=starttls
MAIL_FROM_ADDRESS="hello@example.com"
MAIL_FROM_NAME="${APP_NAME}"
Disclosure: I work for Mailosaur, a similar service as Mailtrap.
答案3
得分: -1
按照以下步骤操作:
- 检查您的用户密码是否正确
- 检查您的邮件提供商是否未关闭您的帐户
- 清除缓存(配置和所有内容)
php artisan optimize:clear
- 逐一尝试检查这些邮件端口(25或465或587或2525)
英文:
Follow these steps:
- Check your user password is correct
- Check your mail provider has not closed your account
- Remove the cache (config and everything)
php artisan optimize:clear
- Try and check these mail ports one by one (25 or 465 or 587 or 2525)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论