问题
I am running a sails.js project using nodemailer locally which is working well.Nodemailer use Smtp and Gmail's service.Problem is when i transfer my project on cloud9 it is blocking mail.
smtpTransport = nodemailer.createTransport('SMTP', {
host: 'smtp.gmail.com',
port: 25,
service: 'Gmail',
auth: {
user: model.sender,
pass: model.password
}
});
here is configurations and error is:
{ [Error: connect ETIMEDOUT]
code: 'ETIMEDOUT',
errno: 'ETIMEDOUT',
syscall: 'connect',
stage: 'init' }
from different searches i got that c9.io isn't supporting smtp.if it is true then how can i use nodemailer with c9 to send mails to gmail account.
on port 465 it gives this error
{ [AuthError: Invalid login - 534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbv2r
534-5.7.14 5eXedgG1jE_vYL7r- o5CxdrMS5XlCbdbloPcENHa08v5fCwuvs7oM9ztAhkUh6RHfRvcBp
534-5.7.14 Qcpg_pdi-2E3Z9m1ipIvu4SZViMJABSDq3XWCMeLzlDfyS3C0JhoY7ldwRxsl3CZ67dvGQ
534-5.7.14
name: 'AuthError',
data: '534-5.7.14 <https://accounts.google.com/ContinueSignIn? sarp=1&scc=1&plt=AKgnsbv2r\r\n534-5.7.14 5eXedgG1jE_vYL7r-o5CxdrMS5XlCbdbloPcENHa08v5fCwuvs7oM9ztAhkUh6RHfRvcBp\r\n534-5.7.14 Qcpg_pdi-2E3Z9m1ipIvu4SZViMJABSDq3XWCMeLzlDfyS3C0JhoY7ldwRxsl3CZ67dvGQ\r\n534-5.7.14 S7PQL4xbl4No8jS_2ZVMnlNO5iYfZ7O9tTe8S1bu3DnkFwjWNNzvLBZ3zK_pzIfMRnH566\r\n534-5.7.14 sEij4Iu9_U6V4g9tCuXH5i87nWYc> Please log in via your web browser and\r\n534-5.7.14 then try again.\r\n534-5.7.14 Learn more at\r\n534 5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754 k6sm6950159wia.6 - gsmtp',
stage: 'auth' }
on port 587 it gives this error
{ [Error: 140581811607424:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:795:
] stage: 'init' }
回答1:
Google Compute Engine does not allow outbound connections on ports 25, 465, and 587 but you can still set up your instances to send mail through ports 587 and 465 using servers provided through partner services, such as SendGrid.
https://cloud.google.com/compute/docs/tutorials/sending-mail
Since Cloud9 workspaces are hosted on GCE, you'll have to use the supported partner services as detailed in the above document.
来源:https://stackoverflow.com/questions/29458359/sending-mail-in-cloud9-io