2016-07-04 4 views
1

node4.js v4.4.7에서 nodemailer v2.4.2를 사용하고 있으며 Office 365 SMTP 메일 서버를 통해 내 서버에서 전자 메일을 보내려고합니다. 나는이 구성으로 smtpTransport의 v2.5.0을 사용하고 있습니다 :Office 365 용 nodemailer 2.x 구성

var transporter = nodemailer.createTransport(smtpTransport({ 
    host: 'smtp.office365.com', 
    port: 25, // have tried 465 
    secureConnection: secure, 
    auth: { 
    user: username, 
    pass: password 
    }, 
    tls: { 
    rejectUnauthorized: false // don't verify certificates 
    }, 
    ignoreTLS: false // don't turn off STARTTLS support 
})); 

나는 authMethodLOGIN의 및 PLAIN를 지정 시도했지만 어떤 차이도하지 않습니다 어느 쪽도했습니다.

[Error: Invalid login: 504 5.7.4 Unrecognized authentication type] 
code: 'EAUTH', 
response: '504 5.7.4 Unrecognized authentication type', 
responseCode: 504 

사람이 오피스 365와 I는 nodemailer 설정에서 어떤 다른 설정을 지정해야하는지 여부를 것으로 예상된다 무엇인가 유형에 대한 어떤 생각을 가지고 있습니까 : 나는 시도하고 이메일을 보낼 때 오류가 발생합니다?

+0

PLZ는 정답을 표시 질문을 해결하는 경우! –

답변

7

이 나를 위해 작동합니다

var transporter = nodemailer.createTransport({ 
     host: 'smtp.office365.com', // Office 365 server 
     port: 587,  // secure SMTP 
     secure: false, // false for TLS - as a boolean not string - but the default is false so just remove this completely 
     auth: { 
      user: username, 
      pass: password 
     }, 
     tls: { 
      ciphers: 'SSLv3' 
     } 
    }); 

당신은 추가 할 수 있습니다

requireTLS: true 
+1

이것은 내 문제를 해결했습니다! 받아 들여 져야한다. 감사합니다. –

+0

이것은 여전히 ​​nodemailer 4.0에서 작동합니다. –