mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05: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
1 changed files with 32 additions and 2 deletions
|
@ -6,7 +6,8 @@
|
||||||
events: {
|
events: {
|
||||||
"click .settings-menu a": "handleMenuClick",
|
"click .settings-menu a": "handleMenuClick",
|
||||||
"click #startupload": "handleUploadClick",
|
"click #startupload": "handleUploadClick",
|
||||||
"click .js-delete": "handleDeleteClick"
|
"click .js-delete": "handleDeleteClick",
|
||||||
|
"click #sendtestmail": "handleSendTestMailClick"
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function () {
|
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…
Add table
Reference in a new issue