나는 서비스 계정 및 JWT 인증을 사용하여 이메일을 보내 매우 도움이되지 않는 메시지를 받고 오류 유지하기 위해 노력하고있어 : { code: 500, message: null }
는 googleapis '서비스 계정 및 nodejs에서 JWT의 인증 메일을 발송 실패했습니다
이 코드 Failed sending mail through google api in nodejs
message
대신 resource
매개 변수의 키를 변경하는 해결책이있는 것 같지만 제대로 작동하지 않습니다. 이것은 키가 아직도 내가 다음
jwtClient.authorize(function(err, res) {
if (err) return console.log('err', err);
var email_lines = [];
email_lines.push("From: \"Some Name Here\" <[email protected]>");
email_lines.push("To: [email protected]");
email_lines.push('Content-type: text/html;charset=iso-8859-1');
email_lines.push('MIME-Version: 1.0');
email_lines.push("Subject: New future subject here");
email_lines.push("");
email_lines.push("And the body text goes here");
email_lines.push("<b>And the bold text goes here</b>");
var email = email_lines.join("\r\n").trim();
var base64EncodedEmailSafe = new Buffer(email).toString('base64').replace(/\+/g, '-').replace(/\//g, '_');
var params = {
auth: jwtClient,
userId: "[email protected]",
resource: {
raw: base64EncodedEmailSafe
}
};
gmail.users.messages.send(params, function(err, res) {
if (err) console.log('error sending mail', err);
else console.log('great success', res);
});
}
으로 이메일을 보내
var jwtClient = new google.auth.JWT(config.SERVICE_EMAIL, config.SERVICE_KEY_PATH, null, config.ALLOWED_SCOPES);
으로 인증하고있어 message
주장 때문에 문서 (https://developers.google.com/gmail/api/v1/reference/users/messages/send를)에서 JS 예에서 이상하다 도서관의 논평은 리소스가 올바른 속성이라고도합니다. (https://github.com/google/google-api-nodejs-client/blob/master/apis/gmail/v1.js)
내가 무엇이 누락 되었습니까?
[github에서 문제가 발생했습니다.] (https://github.com/google/google-api-nodejs-client/issues/347) – dthareja