UI의 단추를 클릭하여 Webix 응용 프로그램에서 전자 메일을 보내려고하면 ajax 호출을 통해 게시 요청을 보냅니다. 백엔드에서 노드 JS 서버백엔드에서 노드 JS 서버의 센드 메일을 사용하여 Webix 응용 프로그램에서 전자 메일을 보내는 방법
{ id:'tb',
view: 'toolbar',
cols: [
{view:"button", id:"mail_btn", type:"icon", label:"SendEmail", tooltip:"Send an email", width:100, on: {onItemClick:function(){sendEmail()}} },
]
}
콜백 함수 : webix 부는 아래와 같다
function sendEmail() {
var bodypart = {"message" : "This is a test mail"};
$.ajax({
type: 'POST',
url: '/appl/email',
data: bodypart,
success: function (data) {
console.log("success");
},
error: function(err){
console.log(err);
}
});
}
}
상기 Ajax 호출 노드에 요청을 전송 JS I 센드 NPM 패키지를 사용하고있는 곳을 달성했다. 아래 코드는 다음과 같습니다 그러나
var sendmail = require('sendmail')();
app.post('/appl/email', sendmail());
function sendEmail() {
sendmail({
from: '[email protected]',
to: '[email protected]',
subject: 'test sendmail',
html: 'Mail of test sendmail ',
}, function(err, reply) {
console.log(err && err.stack);
console.dir(reply);
});
}
, 나는 오류가 아래에 무엇입니까 :
Error: Route.post() requires callback functions but got a [object Undefined]
JS 서버 노드에 요청을 전송하지 않고 자체 webix에서 이메일을 보낼 수있는 방법이 있나요? 다른 방법으로 sendmail npm 패키지를 사용하여이 방법을 얻으려고합니까?
도움을 주시면 감사하겠습니다.
실수를 지적 해 주셔서 감사합니다. 나는 그것을 바로 잡았고 현재 작동 중이다. –