0
emailConfirmation.js에 모듈을 내보내는 방법 :Node.js를
var configAuth = require('../../authentication/sendgrid');
var sendgrid = require('sendgrid')(configAuth.sg.username, configAuth.sg.password);
var from_address = "[email protected]";
var text_body = "sometextbody";
var html_body = "somehtml";
그들을 내가 같이, 포스트 경로에서 사용하기, 내 경로에 수출을해야합니다
app.post('/', function(req, res) {
sendgrid.send({
to: req.body.email,
from: the from_adrres variable from the other file,
subject: "Some subjec",
text: the text_body variable from the other file
html: the html_body variable from the other file
}, function(err, json) {
if (err) {
return console.error(err);
}
console.log(json);
});
});
을 내가 어떻게 할 수있는 emailConfirmation.js를 내보내고 그런 식으로 사용 하시겠습니까 ??
안녕하세요 @ 제이슨, 답변 주셔서 감사합니다. .. 내가 더 잘 이해할 수있는 질문을 업데이트합니다. 확인해 드릴 수 있습니까? –
내 마음 속에는 익명의 유권자가있는 특별한 장소가 있습니다. –
ahahahahah .. 감사합니다 @ 제이슨 :) –