mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
FEATURE: show exact error for test email
This commit is contained in:
parent
a211f542f5
commit
c84b51d4ae
4 changed files with 13 additions and 5 deletions
|
@ -36,8 +36,12 @@ export default DiscourseController.extend({
|
|||
data: { email_address: this.get('testEmailAddress') }
|
||||
}).then(function () {
|
||||
self.set('sentTestEmail', true);
|
||||
}).catch(function () {
|
||||
bootbox.alert(I18n.t('admin.email.test_error'));
|
||||
}, function(e) {
|
||||
if (e.responseJSON && e.responseJSON.errors) {
|
||||
bootbox.alert(I18n.t('admin.email.error', { server_error: e.responseJSON.errors[0] }));
|
||||
} else {
|
||||
bootbox.alert(I18n.t('admin.email.test_error'));
|
||||
}
|
||||
}).finally(function() {
|
||||
self.set('sendingEmail', false);
|
||||
});
|
||||
|
|
|
@ -9,8 +9,12 @@ class Admin::EmailController < Admin::AdminController
|
|||
|
||||
def test
|
||||
params.require(:email_address)
|
||||
Jobs::TestEmail.new.execute(to_address: params[:email_address])
|
||||
render nothing: true
|
||||
begin
|
||||
Jobs::TestEmail.new.execute(to_address: params[:email_address])
|
||||
render nothing: true
|
||||
rescue => e
|
||||
render json: {errors: [e.message]}, status: 422
|
||||
end
|
||||
end
|
||||
|
||||
def all
|
||||
|
|
|
@ -52,4 +52,3 @@ Discourse::Application.configure do
|
|||
config.developer_emails = emails.split(",").map(&:strip)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1760,6 +1760,7 @@ en:
|
|||
settings: "Settings"
|
||||
all: "All"
|
||||
sending_test: "Sending test Email..."
|
||||
error: "<b>ERROR</b> - %{server_error}"
|
||||
test_error: "There was a problem sending the test email. Please double-check your mail settings, verify that your host is not blocking mail connections, and try again."
|
||||
sent: "Sent"
|
||||
skipped: "Skipped"
|
||||
|
|
Loading…
Reference in a new issue