发送邮件到mailtrap.io [英] sending mail to mailtrap.io

查看:167
本文介绍了发送邮件到mailtrap.io的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Laravel 5.1 我在应用程序中创建了一个联系页面.因此用户可以发送电子邮件.在这里我使用了mailtrap.io 创建后就可以使用.我的意思是将邮件发送到mailtrap.io没有问题

I am using Laravel 5.1 I made a contact page in my application. So users can send an email. Here I have used mailtrap.io It works when I have created. I mean there was no problem to send mail to mailtrap.io

但是今天,当我再次检查时,它向我显示了此错误.

But today, when I was checking this again, It shows me this error.

StreamBuffer.php第268行中的

Swift_TransportException: 无法使用主机mailtrap.io建立连接[连接尝试失败,因为在一段时间后被连接方未正确响应,或者由于连接的主机未能响应而建立的连接失败. #10060]

Swift_TransportException in StreamBuffer.php line 268: Connection could not be established with host mailtrap.io [A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. #10060]

我已经用mailtrap.io设置检查了.env文件.一切都好.这是我的.env文件设置

I have checked my .env file with mailtrap.io setting. everything is ok. Here is my .env file setting

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=25
MAIL_USERNAME=[username]
MAIL_PASSWORD=[password]
MAIL_ENCRYPTION=tls

有人请帮助我吗?

推荐答案

可能是您的提供商或主机阻止了端口25的问题.

Probably you have issues with port 25 being blocked by your provider or host.

您可以使用telnet进行验证:

You can verify this using telnet:

telnet smtp.mailtrap.io 25

如果没有响应或超时,则无法使用端口25.

If you get no response or a timeout, you can not use port 25.

Mailtrap允许您使用其他两个端口2525和465.

Mailtrap allows you to use 2 other ports, 2525 and 465.

您可以使用telnet验证这些端口是否正常工作.

You can verify with telnet if those ports are working.

telnet smtp.mailtrap.io 2525

如果连接正确,请修改您的.env文件以使用2525.

If that connects properly, modify your .env file to use 2525.

如果您使用的是php artisan serve而不是宅基地或其他东西,请确保对.env进行更改后重新启动.

If you are using php artisan serve instead of homestead or something else, be sure to restart after making changes to your .env.

这篇关于发送邮件到mailtrap.io的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆