mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-04 08:54:36 +03:00
Added email sending endpoint to the API.
closes #2550 - Added new API module named 'mail' - Added routes for the mail endpoint - Added 'send a test email' button to the debug settigns page - Added handler to this button which sends and AJAX request to the mail API endpoint
This commit is contained in:
parent
61db2dc335
commit
91a0c7c666
@ -6,7 +6,8 @@
|
||||
events: {
|
||||
"click .settings-menu a": "handleMenuClick",
|
||||
"click #startupload": "handleUploadClick",
|
||||
"click .js-delete": "handleDeleteClick"
|
||||
"click .js-delete": "handleDeleteClick",
|
||||
"click #sendtestmail": "handleSendTestMailClick"
|
||||
},
|
||||
|
||||
initialize: function () {
|
||||
@ -154,6 +155,35 @@
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
},
|
||||
|
||||
handleSendTestMailClick: function (ev) {
|
||||
ev.preventDefault();
|
||||
|
||||
$.ajax({
|
||||
url: Ghost.paths.apiRoot + '/mail/test/',
|
||||
type: 'POST',
|
||||
headers: {
|
||||
'X-CSRF-Token': $("meta[name='csrf-param']").attr('content')
|
||||
},
|
||||
success: function onSuccess(response) {
|
||||
Ghost.notifications.addItem({
|
||||
type: 'success',
|
||||
message: ['Check your email for the test message: ', response.message].join(''),
|
||||
status: 'passive'
|
||||
});
|
||||
},
|
||||
error: function onError(response) {
|
||||
var responseText = JSON.parse(response.responseText),
|
||||
message = responseText && responseText.error ? responseText.error : 'unknown';
|
||||
Ghost.notifications.addItem({
|
||||
type: 'error',
|
||||
message: ['A problem was encountered while sending the test email: ', message].join(''),
|
||||
status: 'passive'
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
}());
|
||||
|
Loading…
Reference in New Issue
Block a user