2014-11-05 2 views
1

nodemailer로 메일을 보내려고합니다. 스크립트는 로컬 컴퓨터에서 작동하지만 푸른 모바일 서비스에 nodemailer를 포함 할 수 없습니다. 내 패키지에 'nodemailer': "*"를 추가했지만 여전히 포함 할 수 없습니다.하늘빛 모바일 서비스에서 nodemailer가 작동하지 않습니다.

로그

형식 오류 말한다 : 나는 밖으로 완전한 논리 댓글을 달았지만 오류가 여전히 정의되지 않은

의 특성 '프로토 타입'을 읽을 수 없습니다. 마지막으로 주석 처리 됨 var nodemailer = require ('nodemailer');

오류가 발생했습니다.

+0

사용중인 동일한 (또는 유사한) 노드의 버전? nodemailer 0.7을 로컬로 사용하고 있습니까? 1.0은 원격으로 사용합니까? 완전한 스택 트레이스를 줄 수 있습니까? – RikkusRukkus

+0

당신 말이 맞아요. 내 컴퓨터의 노드 버전은 0.10.29이고 내 컴퓨터의 노드 버전은 0.8.28입니다. azure-mobile-service에서 nodejs 버전을 업데이트하는 방법에 대한 아이디어가 있습니까? 또는 해당 버전과 호환되는 종속성을 설치하는 방법. nodemailer 버전을 확인했으며 두 시스템에서 모두 동일합니다 (1.3.0). – ribhu

+1

거기에서 도와 드릴 수 없습니다, 죄송합니다. [개발자에 따르면] (https://github.com/andris9/Nodemailer/issues/346), nodemailer 0.7.1은 마지막 0.8 호환 버전입니다. 코드를 일부 변경해야합니다. nodemailer 1.x는 0.x 버전과 완전히 호환되지 않습니다. – RikkusRukkus

답변

0

이 문제를 해결하려면 이전 버전의 nodemailer를 설치해야 Azure 모바일 서비스에서 작동 할 수 있습니다. Azure 용 package.json에 nodemailer 버전 0.7.1을 추가 한 다음 필요한 코드를 변경하고 나에게 도움이되었습니다.

는, 여기에 문서에서 전체 코드의 코드는 0.7.1 아주 사소한 지원을 할 필요가 변경

입니다 :

var nodemailer = require("nodemailer"); 

// create reusable transport method (opens pool of SMTP connections) 
var smtpTransport = nodemailer.createTransport("SMTP",{ 
    service: "Gmail", 
    auth: { 
     user: "[email protected]", 
     pass: "userpass" 
    } 
}); 

// setup e-mail data with unicode symbols 
var mailOptions = { 
    from: "Fred Foo ✔ <[email protected]>", // sender address 
    to: "[email protected], [email protected]", // list of receivers 
    subject: "Hello ✔", // Subject line 
    text: "Hello world ✔", // plaintext body 
    html: "<b>Hello world ✔</b>" // html body 
} 

// send mail with defined transport object 
smtpTransport.sendMail(mailOptions, function(error, response){ 
    if(error){ 
     console.log(error); 
    }else{ 
     console.log("Message sent: " + response.message); 
    } 

    // if you don't want to use this transport object anymore, uncomment following line 
    //smtpTransport.close(); // shut down the connection pool, no more messages 
}); 

Nodemailer 0.7.1 documentation

관련 문제