mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-30 10:58:31 -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') }
|
data: { email_address: this.get('testEmailAddress') }
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
self.set('sentTestEmail', true);
|
self.set('sentTestEmail', true);
|
||||||
}).catch(function () {
|
}, 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'));
|
bootbox.alert(I18n.t('admin.email.test_error'));
|
||||||
|
}
|
||||||
}).finally(function() {
|
}).finally(function() {
|
||||||
self.set('sendingEmail', false);
|
self.set('sendingEmail', false);
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,8 +9,12 @@ class Admin::EmailController < Admin::AdminController
|
||||||
|
|
||||||
def test
|
def test
|
||||||
params.require(:email_address)
|
params.require(:email_address)
|
||||||
|
begin
|
||||||
Jobs::TestEmail.new.execute(to_address: params[:email_address])
|
Jobs::TestEmail.new.execute(to_address: params[:email_address])
|
||||||
render nothing: true
|
render nothing: true
|
||||||
|
rescue => e
|
||||||
|
render json: {errors: [e.message]}, status: 422
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def all
|
def all
|
||||||
|
|
|
@ -52,4 +52,3 @@ Discourse::Application.configure do
|
||||||
config.developer_emails = emails.split(",").map(&:strip)
|
config.developer_emails = emails.split(",").map(&:strip)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1760,6 +1760,7 @@ en:
|
||||||
settings: "Settings"
|
settings: "Settings"
|
||||||
all: "All"
|
all: "All"
|
||||||
sending_test: "Sending test Email..."
|
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."
|
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"
|
sent: "Sent"
|
||||||
skipped: "Skipped"
|
skipped: "Skipped"
|
||||||
|
|
Loading…
Reference in a new issue