diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 19efb28c..95d3505c 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -56,6 +56,20 @@ class AdminController < ApplicationController end end + def test_email + raise_delivery_errors = ActionMailer::Base.raise_delivery_errors + # Force ActionMailer to raise delivery errors so we can catch it + ActionMailer::Base.raise_delivery_errors = true + begin + @test = Mailer.deliver_test(logged_in_user) + flash[:notice] = l(:notice_email_sent, logged_in_user.mail) + rescue Exception => e + flash[:error] = l(:notice_email_error, e.message) + end + ActionMailer::Base.raise_delivery_errors = raise_delivery_errors + redirect_to :action => 'mail_options' + end + def info @db_adapter_name = ActiveRecord::Base.connection.adapter_name @flags = Hash.new diff --git a/app/models/mailer.rb b/app/models/mailer.rb index cd5925da..447feb0d 100644 --- a/app/models/mailer.rb +++ b/app/models/mailer.rb @@ -113,4 +113,11 @@ class Mailer < ActionMailer::Base @subject = "[#{message.board.project.name} - #{message.board.name}] #{message.subject}" @body['message'] = message end + + def test(user) + set_language_if_valid(user.language) + @recipients = user.mail + @from = Setting.mail_from + @subject = 'Redmine' + end end diff --git a/app/views/admin/mail_options.rhtml b/app/views/admin/mail_options.rhtml index ef22fe53..c7096577 100644 --- a/app/views/admin/mail_options.rhtml +++ b/app/views/admin/mail_options.rhtml @@ -16,10 +16,11 @@
<% end %> -
-

<%= check_all_links('mail_options_form') %>

+<%= check_all_links('mail_options_form') %> -<%= submit_tag l(:button_save) %> +

<%= submit_tag l(:button_save) %>

<% end %> + +<%= link_to l(:label_send_test_email), :action => 'test_email' %> diff --git a/app/views/mailer/test.rhtml b/app/views/mailer/test.rhtml new file mode 100644 index 00000000..0e1629ba --- /dev/null +++ b/app/views/mailer/test.rhtml @@ -0,0 +1 @@ +This is a test email sent by Redmine. diff --git a/lang/bg.yml b/lang/bg.yml index 3afcc54f..337b167b 100644 --- a/lang/bg.yml +++ b/lang/bg.yml @@ -69,6 +69,8 @@ notice_file_not_found: Несъществуваща или преместена notice_locking_conflict: Друг потребител променя тези данни в момента. notice_scm_error: Несъществуващ обект в склада. notice_not_authorized: Нямате право на достъп до тази страница. +notice_email_sent: An email was sent to %s +notice_email_error: An error occurred while sending mail (%s)" mail_subject_lost_password: Вашата парола mail_subject_register: Активация на акаунт @@ -407,6 +409,7 @@ label_date_from: From label_date_to: To label_language_based: Language based label_sort_by: Sort by "%s" +label_send_test_email: Send a test email button_login: Вход button_submit: Изпращане diff --git a/lang/de.yml b/lang/de.yml index 9c59a1d5..32ad4bce 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -69,6 +69,8 @@ notice_file_not_found: Anhang besteht nicht oder ist gelöscht worden. notice_locking_conflict: Datum wurde von einem anderen Benutzer geändert. notice_scm_error: Eintrag und/oder Revision besteht nicht im Projektarchiv. notice_not_authorized: Sie sind nicht berechtigt auf diese Seite zuzugreifen. +notice_email_sent: An email was sent to %s +notice_email_error: An error occurred while sending mail (%s)" mail_subject_lost_password: Ihr redMine Kennwort mail_subject_register: redMine Kontoaktivierung @@ -407,6 +409,7 @@ label_date_from: Von label_date_to: Bis label_language_based: Language based label_sort_by: Sort by "%s" +label_send_test_email: Send a test email button_login: Einloggen button_submit: OK diff --git a/lang/en.yml b/lang/en.yml index c144ab48..3488ee34 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -69,6 +69,8 @@ notice_file_not_found: The page you were trying to access doesn't exist or has b notice_locking_conflict: Data have been updated by another user. notice_scm_error: Entry and/or revision doesn't exist in the repository. notice_not_authorized: You are not authorized to access this page. +notice_email_sent: An email was sent to %s +notice_email_error: An error occurred while sending mail (%s)" mail_subject_lost_password: Your redMine password mail_subject_register: redMine account activation @@ -407,6 +409,7 @@ label_date_from: From label_date_to: To label_language_based: Language based label_sort_by: Sort by "%s" +label_send_test_email: Send a test email button_login: Login button_submit: Submit diff --git a/lang/es.yml b/lang/es.yml index a494fdfa..26eca0bc 100644 --- a/lang/es.yml +++ b/lang/es.yml @@ -69,6 +69,8 @@ notice_file_not_found: La página que intentabas tener acceso no existe ni se ha notice_locking_conflict: Data have been updated by another user. notice_scm_error: La entrada y/o la revisión no existe en el depósito. notice_not_authorized: You are not authorized to access this page. +notice_email_sent: An email was sent to %s +notice_email_error: An error occurred while sending mail (%s)" mail_subject_lost_password: Tu contraseña del redMine mail_subject_register: Activación de la cuenta del redMine @@ -407,6 +409,7 @@ label_date_from: From label_date_to: To label_language_based: Language based label_sort_by: Sort by "%s" +label_send_test_email: Send a test email button_login: Conexión button_submit: Someter diff --git a/lang/fr.yml b/lang/fr.yml index e0b66692..36435978 100644 --- a/lang/fr.yml +++ b/lang/fr.yml @@ -65,10 +65,12 @@ notice_successful_create: Création effectuée avec succès. notice_successful_update: Mise à jour effectuée avec succès. notice_successful_delete: Suppression effectuée avec succès. notice_successful_connection: Connection réussie. -notice_file_not_found: La page à laquelle vous souhaitez accéder n'existe pas ou a été supprimée. +notice_file_not_found: "La page à laquelle vous souhaitez accéder n'existe pas ou a été supprimée." notice_locking_conflict: Les données ont été mises à jour par un autre utilisateur. Mise à jour impossible. -notice_scm_error: L'entrée et/ou la révision demandée n'existe pas dans le dépôt. -notice_not_authorized: Vous n'êtes pas autorisés à accéder à cette page. +notice_scm_error: "L'entrée et/ou la révision demandée n'existe pas dans le dépôt." +notice_not_authorized: "Vous n'êtes pas autorisés à accéder à cette page." +notice_email_sent: "Un email a été envoyé à %s" +notice_email_error: "Erreur lors de l'envoi de l'email (%s)" mail_subject_lost_password: Votre mot de passe redMine mail_subject_register: Activation de votre compte redMine @@ -407,6 +409,7 @@ label_date_from: Du label_date_to: Au label_language_based: Basé sur la langue label_sort_by: Trier par "%s" +label_send_test_email: Envoyer un email de test button_login: Connexion button_submit: Soumettre diff --git a/lang/it.yml b/lang/it.yml index 5cc81a67..d3f04b9c 100644 --- a/lang/it.yml +++ b/lang/it.yml @@ -69,6 +69,8 @@ notice_file_not_found: La pagina desiderata non esiste o è stata rimossa. notice_locking_conflict: Le informazioni sono state modificate da un altro utente. notice_scm_error: La risorsa e/o la versione non esistono nel repository. notice_not_authorized: You are not authorized to access this page. +notice_email_sent: An email was sent to %s +notice_email_error: An error occurred while sending mail (%s)" mail_subject_lost_password: Password redMine mail_subject_register: Attivazione utenza redMine @@ -407,6 +409,7 @@ label_date_from: From label_date_to: To label_language_based: Language based label_sort_by: Sort by "%s" +label_send_test_email: Send a test email button_login: Login button_submit: Invia diff --git a/lang/ja.yml b/lang/ja.yml index 34a1bbec..703652bc 100644 --- a/lang/ja.yml +++ b/lang/ja.yml @@ -70,6 +70,8 @@ notice_file_not_found: アクセスしようとしたページは存在しない notice_locking_conflict: 別のユーザがデータを更新しています。 notice_scm_error: リポジトリに、エントリ/リビジョンが存在しません。 notice_not_authorized: このページにアクセスするには認証が必要です。 +notice_email_sent: An email was sent to %s +notice_email_error: An error occurred while sending mail (%s)" mail_subject_lost_password: redMineパスワード mail_subject_register: redMineアカウントが有効になりました @@ -408,6 +410,7 @@ label_date_from: From label_date_to: To label_language_based: Language based label_sort_by: Sort by "%s" +label_send_test_email: Send a test email button_login: ログイン button_submit: 変更 diff --git a/lang/nl.yml b/lang/nl.yml index 99ea5b3a..29b7751c 100644 --- a/lang/nl.yml +++ b/lang/nl.yml @@ -69,6 +69,8 @@ notice_file_not_found: De pagina die U probeerde te benaderen bestaat niet of is notice_locking_conflict: De gegevens zijn gewijzigd door een andere gebruiker. notice_scm_error: Deze ingang of revisie bestaat niet in de repository. notice_not_authorized: Het is U niet toegestaan om deze pagina te raadplegen. +notice_email_sent: An email was sent to %s +notice_email_error: An error occurred while sending mail (%s)" mail_subject_lost_password: Uw redMine wachtwoord mail_subject_register: redMine account activatie @@ -407,6 +409,7 @@ label_date_from: From label_date_to: To label_language_based: Language based label_sort_by: Sort by "%s" +label_send_test_email: Send a test email button_login: Inloggen button_submit: Toevoegen diff --git a/lang/pt-br.yml b/lang/pt-br.yml index 6043c8bc..7196db85 100644 --- a/lang/pt-br.yml +++ b/lang/pt-br.yml @@ -69,6 +69,8 @@ notice_file_not_found: A pagina que voce esta tentando acessar nao existe ou foi notice_locking_conflict: Os dados foram atualizados por um outro usuario. notice_scm_error: A entrada e/ou a revisao nao existem no repositorio. notice_not_authorized: You are not authorized to access this page. +notice_email_sent: An email was sent to %s +notice_email_error: An error occurred while sending mail (%s)" mail_subject_lost_password: Sua senha do redMine. mail_subject_register: Ativacao de conta do redMine. @@ -407,6 +409,7 @@ label_date_from: From label_date_to: To label_language_based: Language based label_sort_by: Sort by "%s" +label_send_test_email: Send a test email button_login: Login button_submit: Enviar diff --git a/lang/pt.yml b/lang/pt.yml index 6b137cde..face383c 100644 --- a/lang/pt.yml +++ b/lang/pt.yml @@ -69,6 +69,8 @@ notice_file_not_found: A página que você está tentando acessar não existe ou notice_locking_conflict: Os dados foram atualizados por um outro usuário. notice_scm_error: A entrada e/ou a revisão não existem no repositório. notice_not_authorized: Você não está autorizado a acessar esta página. +notice_email_sent: An email was sent to %s +notice_email_error: An error occurred while sending mail (%s)" mail_subject_lost_password: Sua senha do redMine. mail_subject_register: Ativação de conta do redMine. @@ -407,6 +409,7 @@ label_date_from: From label_date_to: To label_language_based: Language based label_sort_by: Sort by "%s" +label_send_test_email: Send a test email button_login: Login button_submit: Enviar diff --git a/lang/sv.yml b/lang/sv.yml index 8f482401..70cb15c3 100644 --- a/lang/sv.yml +++ b/lang/sv.yml @@ -69,6 +69,8 @@ notice_file_not_found: Sidan du försökte komma åt existerar inte eller har bl notice_locking_conflict: Data har uppdaterats av en annan användare. notice_scm_error: Inlägg och/eller revision finns inte i repositoriet. notice_not_authorized: You are not authorized to access this page. +notice_email_sent: An email was sent to %s +notice_email_error: An error occurred while sending mail (%s)" mail_subject_lost_password: Ditt redMine lösenord mail_subject_register: redMine kontoaktivering @@ -407,6 +409,7 @@ label_date_from: From label_date_to: To label_language_based: Language based label_sort_by: Sort by "%s" +label_send_test_email: Send a test email button_login: Logga in button_submit: Skicka diff --git a/lang/zh.yml b/lang/zh.yml index 043aad1e..de8cfdb7 100644 --- a/lang/zh.yml +++ b/lang/zh.yml @@ -72,6 +72,8 @@ notice_file_not_found: 您访问的页面不存在或已被删除。 notice_locking_conflict: 数据已被另一个用户更新 notice_scm_error: 在版本库中不存在该条目或修订 notice_not_authorized: You are not authorized to access this page. +notice_email_sent: An email was sent to %s +notice_email_error: An error occurred while sending mail (%s)" mail_subject_lost_password: 您的redMine口令 mail_subject_register: redMine帐户激活 @@ -409,6 +411,7 @@ label_date_from: From label_date_to: To label_language_based: Language based label_sort_by: Sort by "%s" +label_send_test_email: Send a test email button_login: 登录 button_submit: 提交