SMTP 服务器不工作,运行 在 Node.js 上使用 Mailin 包
SMTP server not working, running on Node.js with Mailin package
我遵循了 Mailin docs 但没能成功。
我的域名是:aryan.ml
我正在使用 Amazon Route 53 进行 DNS 配置。这是一个截图:
在我的 app.js 文件中,我也是 运行 官方 Mailin 文档提供的示例代码。该代码位于 http://mailin.io/doc
的 "Embedded inside a node application" 标题下
var mailin = require('mailin');
mailin.start({
port: 25,
disableWebhook: true // Disable the webhook posting.
});
/* Access simplesmtp server instance. */
mailin.on('authorizeUser', function(connection, username, password, done) {
if (username == "johnsmith" && password == "mysecret") {
done(null, true);
} else {
done(new Error("Unauthorized!"), false);
}
});
/* Event emitted when a connection with the Mailin smtp server is initiated. */
mailin.on('startMessage', function(connection) {
/* connection = {
from: 'sender@somedomain.com',
to: 'someaddress@yourdomain.com',
id: 't84h5ugf',
authentication: { username: null, authenticated: false, status: 'NORMAL' }
}
}; */
console.log(connection);
});
/* Event emitted after a message was received and parsed. */
mailin.on('message', function(connection, data, content) {
console.log(data);
/* Do something useful with the parsed message here.
* Use parsed message `data` directly or use raw message `content`. */
});
我也尝试使用 mxtoolbox 测试我的设置,但它 "Failed to connect" 到我的 MX 服务器。 http://mxtoolbox.com/SuperTool.aspx?action=smtp%3amxemail.aryan.ml&run=toolpage
非常感谢help/guidance。
您需要确保这两件事是正确的(对于 AWS):
- 原来是我的 Amazon 的安全组一直阻止端口 25。如果您在 AWS 上遇到类似问题,请务必确保允许流量通过服务器的端口 25。
- 对于 Mailin 包导航到
/node_modules/mailin/lib/mailin.js
并将 host
的默认值更改为 0.0.0.0
,它位于第 27 行。这解决了 AWS 上的问题。
我遵循了 Mailin docs 但没能成功。
我的域名是:aryan.ml
我正在使用 Amazon Route 53 进行 DNS 配置。这是一个截图:
在我的 app.js 文件中,我也是 运行 官方 Mailin 文档提供的示例代码。该代码位于 http://mailin.io/doc
的 "Embedded inside a node application" 标题下var mailin = require('mailin');
mailin.start({
port: 25,
disableWebhook: true // Disable the webhook posting.
});
/* Access simplesmtp server instance. */
mailin.on('authorizeUser', function(connection, username, password, done) {
if (username == "johnsmith" && password == "mysecret") {
done(null, true);
} else {
done(new Error("Unauthorized!"), false);
}
});
/* Event emitted when a connection with the Mailin smtp server is initiated. */
mailin.on('startMessage', function(connection) {
/* connection = {
from: 'sender@somedomain.com',
to: 'someaddress@yourdomain.com',
id: 't84h5ugf',
authentication: { username: null, authenticated: false, status: 'NORMAL' }
}
}; */
console.log(connection);
});
/* Event emitted after a message was received and parsed. */
mailin.on('message', function(connection, data, content) {
console.log(data);
/* Do something useful with the parsed message here.
* Use parsed message `data` directly or use raw message `content`. */
});
我也尝试使用 mxtoolbox 测试我的设置,但它 "Failed to connect" 到我的 MX 服务器。 http://mxtoolbox.com/SuperTool.aspx?action=smtp%3amxemail.aryan.ml&run=toolpage
非常感谢help/guidance。
您需要确保这两件事是正确的(对于 AWS):
- 原来是我的 Amazon 的安全组一直阻止端口 25。如果您在 AWS 上遇到类似问题,请务必确保允许流量通过服务器的端口 25。
- 对于 Mailin 包导航到
/node_modules/mailin/lib/mailin.js
并将host
的默认值更改为0.0.0.0
,它位于第 27 行。这解决了 AWS 上的问题。