CONTEXT : 내 웹 응용 프로그램의 백엔드로 Parse.com을 사용하고이메일 알림
. 새로운 사용자가 가입하면 (즉, 새 레코드가 '사용자'테이블에 저장 될 때) 이메일을 보내고 싶습니다. 나는 Parse를 위해 SendGrid Module을 사용하고있다.
문제 : 이메일이 전송하지 않습니다
. 나는 성공이나 오류 응답을받지 못한다. 로그 파일은 "2 단계"를 인쇄하지만 "3 단계"는 인쇄하지 않습니다 (아래 참조).
"mySendGridFunction"이 무엇이라도 참조하고 변경해야하는지 확실하지 않습니다.
CODE :
Parse.Cloud.afterSave (Parse.User, 기능 (요청) { // 함수 ( 을 console.log를 시작 나타냅니다 "********* ************************* "); console.log ("** 새 사용자 전자 메일 알림 *** "); console.log ("**********************************");
// For New Users Only if(!(request.object.existed())){ // New User Identified console.log("New user identified"); // Initialize SendGrid Module var sendgrid = require("sendgrid"); sendgrid.initialize("myUsername", "myPassword"); console.log("Step 2"); // Send Email Parse.Cloud.define("mySendGridFunction", function(request, response) { console.log("Step 3"); sendgrid.sendEmail({ to: "[email protected]", from: "[email protected]", //from: "[email protected]", subject: "Notification: New User", text: "A new user has just signed up." }, { success: function(httpResponse) { console.log("User Notification email being sent"); console.log("HTTP Response: " + httpResponse); response.success("User Notification email successfully sent"); }, error: function(httpResponse) { console.log("There was an error sending the User Notification email"); console.error("HTTP Response: " + httpResponse); response.error("There was an error sending the User Notification email"); } }); }); }
});