mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Merge pull request #2551 from szelpe/email-test
[API] Added email sending endpoint to the API.
This commit is contained in:
commit
9db24568e9
1 changed files with 32 additions and 2 deletions
|
@ -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…
Add table
Reference in a new issue