我刚开始使用Adonisjs框架,并尝试通过Mailtrap发送一封假邮件。问题是我总是遇到错误connect ECONNREFUSED 52.202.164.124:2525。
环境:
MAIL_CONNECTION=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_USERNAME=ebe8f4522c4fcc
MAIL_PASSWORD=0bb7b98785dab1config/mail.js:
connection: Env.get('MAIL_CONNECTION', 'smtp'),
/*
|--------------------------------------------------------------------------
| SMTP
|--------------------------------------------------------------------------
|
| Here we define configuration for sending emails via SMTP.
|
*/
smtp: {
driver: 'smtp',
pool: true,
port: 2525,
host: Env.get('MAIL_HOST'),
secure: false,
auth: {
user: Env.get('MAIL_USERNAME'),
pass: Env.get('MAIL_PASSWORD')
},
maxConnections: 5,
maxMessages: 100,
rateLimit: 10
},控制器:
await Mail.send('authentication.emails.confirm_email', user.toJSON(), message => {
message.to(user.email)
.from('hello@adonisjs.com')
.subject('Please confirm your email address')
})也许有人可以帮助我:)
发布于 2018-06-12 23:44:08
我将端口更改为25,它现在可以工作了。我仍然不知道我之前不能连接的原因。可能是防火墙的问题。
发布于 2019-06-03 21:40:38
将值更改为MAIL_PORT=25
https://stackoverflow.com/questions/50818663
复制相似问题