我在家中有一个静态IP的服务器,我为自己的网页提供了一个域,并且一切正常。如何使用邮件服务器和nodejs从我的服务器发送电子邮件
在我的网页上,您可以通过电子邮件和密码注册。当您注册名为nodemailer的节点模块时,会从Google帐户发送电子邮件,问题在于Google帐户具有已发送电子邮件的限制。
所以我需要将nodemailer模块连接到我自己家中的服务器。
我在谷歌搜索,但没有类似的答案。
如何使用postfix与nodejs?
或如何使用haraka模块nodemailer
https://github.com/baudehlo/Haraka
所以我重复我的问题,我需要从我的服务器发送电子邮件至,在我的网站注册的任何电子邮件用户。
例如...
用户[email protected]在我的网站进行注册
nodemailer配置...
exports.newRegistration=function(parametros,callback)
{
var mailOptions =
{
from: "<[email protected]>",//my email
to: parametros.useremail,//user email
subject: 'Welcome '+parametros.useremail+'.',
html: '<br><b>Hello</b><br>'+ // html
};
var smtpTransport = nodemailer.createTransport("SMTP",
{
service: "Gmail",
secureConnection: true,
auth:
{
user: "[email protected]",
pass: "7ftera359c28a",
},
});
smtpTransport.sendMail(mailOptions, function(err, response)
{
if(err)
{
smtpTransport.close();
console.warn(err);
return callback(err,null);
}else{
smtpTransport.close();
return callback(null,response);
}
});
}
电子邮件发送OK,但它有一个限制每天。
,所以我需要使用电子邮件服务器发送我的电子邮件没有限制.... TNX
EDIT 2
我安装与mailutils apt-get的
,现在我尝试
mail [email protected]
Cc: // press enter
Subject: Welcome
Hello Mail.
// Ctrl+D
此电子邮件发送到我的邮箱,我在垃圾邮件收到一封电子邮件,从[email protected]发送
因此,后缀是工作,但我仍然无法发送带有emailjs或nodemailer电子邮件...
当我尝试发送电子邮件与电子邮件或nodemailer我得到这个
smtp: '535 5.7.8 Error: authentication failed: generic failure\n'
我在搜索谷歌的错误,是和auth登录错误,我无法登录到系统。 所以我尽量通过telnet
telnet localhost 25
ehlo localhost
250-mydomain.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
mail to: [email protected]
501 5.5.4 Syntax: MAIL FROM:<address>
mail from: [email protected]
250 2.1.0 Ok
rcpt to: [email protected]
451 4.3.0 <[email protected]>: Temporary lookup failure
data
554 5.5.1 Error: no valid recipients
AUTH LOGIN
503 5.5.1 Error: MAIL transaction in progress
我再试
220 mydomain.com ESMTP Postfix (Ubuntu)
ehlo localhost
250-mydomain.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
AUTH LOGIN
334 VXNlcm5hbWU6
UbuntuUser
535 5.7.8 Error: authentication failed: another step is needed in authentication
,并再次以root
220 mydomain.com ESMTP Postfix (Ubuntu)
ehlo localhost
250-mydomain.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
auth login
334 VXNlcm5hbWU6
root
334 UGFzc3dvcmQ6
rootPassword
535 5.7.8 Error: authentication failed: another step is needed in authentication
这是日志文件
Jun 20 15:50:16 myname postfix/smtpd[12528]: warning: localhost[127.0.0.1]: SASL login authentication failed: another step is needed in authentication
,就是这样。亲们在哪里在这个咩?
好吧,我觉得这是即时寻找....我会在这一刻 – andrescabana86
想我有一个错误:{[错误:authorization.failed] 代码:3, 以前: {[错误:对命令'N2Z0ZXJhMzU5YzI4YQ =='错误的响应' 代码:2, smtp:'535 5.7.8错误:认证失败:通用故障\ n'}, smtp:undefined} – andrescabana86