From b0bfeb374acdad2f82928dcfc6ffa86e2872316a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 21 Mar 2025 23:52:40 +0000 Subject: [PATCH 01/17] Bump nokogiri in the bundler group across 1 directory Bumps the bundler group with 1 update in the / directory: [nokogiri](https://github.com/sparklemotion/nokogiri). Updates `nokogiri` from 1.18.3 to 1.18.4 - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/main/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.18.3...v1.18.4) --- updated-dependencies: - dependency-name: nokogiri dependency-type: indirect dependency-group: bundler ... Signed-off-by: dependabot[bot] --- Gemfile.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5d04ded..956054a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -233,18 +233,18 @@ GEM net-smtp (0.5.1) net-protocol nio4r (2.7.4) - nokogiri (1.18.3) + nokogiri (1.18.4) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.18.3-aarch64-linux-gnu) + nokogiri (1.18.4-aarch64-linux-gnu) racc (~> 1.4) - nokogiri (1.18.3-arm-linux-gnu) + nokogiri (1.18.4-arm-linux-gnu) racc (~> 1.4) - nokogiri (1.18.3-arm64-darwin) + nokogiri (1.18.4-arm64-darwin) racc (~> 1.4) - nokogiri (1.18.3-x86_64-darwin) + nokogiri (1.18.4-x86_64-darwin) racc (~> 1.4) - nokogiri (1.18.3-x86_64-linux-gnu) + nokogiri (1.18.4-x86_64-linux-gnu) racc (~> 1.4) orm_adapter (0.5.0) pg (1.5.9) From e40509f89b8cdc1b085c4ef6cd62575636c72e84 Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Thu, 27 Mar 2025 18:47:37 -0400 Subject: [PATCH 02/17] Remove default email sender from ApplicationMailer class --- app/mailers/application_mailer.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index f6d3dd5..d8bd387 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,4 +1,3 @@ class ApplicationMailer < ActionMailer::Base - default from: 'bearriver-questions@umich.edu' layout 'mailer' end From 3af083860187eec96612912dae90062ef35b79ae Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Thu, 27 Mar 2025 18:48:19 -0400 Subject: [PATCH 03/17] Refactor Action Mailer configuration across environments - Introduced `mailer_sender` configuration to utilize credentials for email sender across development, production, staging, and test environments. - Updated `default_options` for Action Mailer to include `from` and `reply_to` fields, ensuring consistent email handling. --- config/environments/development.rb | 6 ++++++ config/environments/production.rb | 21 +++++++++++++-------- config/environments/staging.rb | 6 +++++- config/environments/test.rb | 5 +++++ 4 files changed, 29 insertions(+), 9 deletions(-) diff --git a/config/environments/development.rb b/config/environments/development.rb index f938f87..e3281ed 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -40,6 +40,12 @@ # on staging use host = 'http://STAGING SERVER NAME' config.action_mailer.default_url_options = { host: host } + config.mailer_sender = Rails.application.credentials.dig(:devise, :mailer_sender) + config.action_mailer.default_options = { + from: config.mailer_sender, + reply_to: 'bearriver-questions@umich.edu' + } + # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = true diff --git a/config/environments/production.rb b/config/environments/production.rb index 1712b71..22578b3 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -71,18 +71,23 @@ # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "bearriver2_production" - # The `perform_caching` option determines whether or not Action Mailer will - # cache emails. When set to `true`, Action Mailer will cache emails to improve - # performance. This can be useful if your application sends out a lot of emails - # that are identical or very similar, as it can reduce the amount of work the + # The `perform_caching` option determines whether or not Action Mailer will + # cache emails. When set to `true`, Action Mailer will cache emails to improve + # performance. This can be useful if your application sends out a lot of emails + # that are identical or very similar, as it can reduce the amount of work the # server has to do. - # When set to `false`, which means that Action Mailer will not cache emails. - # This might be because the emails your application sends are unique, so caching - # wouldn't provide a performance benefit. Or it might be to avoid potential issues + # When set to `false`, which means that Action Mailer will not cache emails. + # This might be because the emails your application sends are unique, so caching + # wouldn't provide a performance benefit. Or it might be to avoid potential issues # with stale or incorrect emails being sent out due to caching. config.action_mailer.perform_caching = false config.action_mailer.perform_deliveries = true - config.action_mailer.default_options = {from: 'bearriver-questions@umich.edu'} + # Set the default sender email (used by ActionMailer) + config.mailer_sender = Rails.application.credentials.dig(:devise, :mailer_sender) + config.action_mailer.default_options = { + from: config.mailer_sender, + reply_to: 'bearriver-questions@umich.edu' + } config.action_mailer.raise_delivery_errors = true config.action_mailer.delivery_method = :smtp host = 'https://bearriver.lsa.umich.edu/' diff --git a/config/environments/staging.rb b/config/environments/staging.rb index acc5866..65dabb7 100644 --- a/config/environments/staging.rb +++ b/config/environments/staging.rb @@ -74,7 +74,11 @@ host = 'https://bearriver-staging.lsa.umich.edu/' # on staging use host = 'http://STAGING SERVER NAME' config.action_mailer.default_url_options = { host: host } - + config.mailer_sender = Rails.application.credentials.dig(:devise, :mailer_sender) + config.action_mailer.default_options = { + from: config.mailer_sender, + reply_to: 'bearriver-questions@umich.edu' + } # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = true diff --git a/config/environments/test.rb b/config/environments/test.rb index adbb4a6..4da36e6 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -38,6 +38,11 @@ config.active_storage.service = :test config.action_mailer.perform_caching = false + config.mailer_sender = Rails.application.credentials.dig(:devise, :mailer_sender) + config.action_mailer.default_options = { + from: config.mailer_sender, + reply_to: 'bearriver-questions@umich.edu' + } # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the From 1bda2a818582619b4113d9e3b40f7c80bb4d573d Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Thu, 27 Mar 2025 18:48:34 -0400 Subject: [PATCH 04/17] Update Devise mailer sender configuration to use Rails credentials - Changed the `mailer_sender` configuration in Devise to retrieve the email address from Rails application credentials, enhancing security and maintainability. --- config/initializers/devise.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/devise.rb b/config/initializers/devise.rb index a921108..ac92dcb 100644 --- a/config/initializers/devise.rb +++ b/config/initializers/devise.rb @@ -24,7 +24,7 @@ # Configure the e-mail address which will be shown in Devise::Mailer, # note that it will be overwritten if you use your own mailer class # with default "from" parameter. - config.mailer_sender = 'bearriver-questions@umich.edu' + config.mailer_sender = Rails.application.credentials.dig(:devise, :mailer_sender) # Configure the class responsible to send e-mails. # config.mailer = 'Devise::Mailer' From e0c95166fe31c73209995e2b196c773e1d1bea17 Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Thu, 27 Mar 2025 18:49:06 -0400 Subject: [PATCH 05/17] Update Devise mailer sender configuration in credentials - Added `mailer_sender` configuration for Devise to specify the email address used for sending emails, improving the application's email handling and maintainability. --- config/credentials.yml.enc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc index c99f9c1..b2c2a9c 100644 --- a/config/credentials.yml.enc +++ b/config/credentials.yml.enc @@ -1 +1 @@ -dt7x+sHj4pT6dmwKsRVXdQFRm3Fyon724KTPW96OXnx6GDQ38i9cK9k24gDAi2+Kb37iyhrlyqTR8gghGIMJTs5kx87lVr1I/socltpl4byqi8CecDxKxSDFNXRh+B9U9XRejucIF6FPNc6KzI/5ybpgFPwy82mZEmWO+VH5eDuwe8JEqbtkmZKzLeALsD2EKuQyGbFb32MZnUVTOYmC6S93ThJSYbwevYH5H4FH6NLjmHzD8d1AjYWh/B9pvO7ys1hm1P05yF0A8QC6bDMLblH29ZAIs0eWhKN0a6Ae+bionPqSP98MhUWgRhb2VDAUXdGTtT60ALy6jbpxyVHCEzIn/1yY7SYcVOhSNTROIhKiEN008aonzexFgxFfYjuJoMCFb5JmD4+Kg8oRPoXB3hRnm9JNMDJpBToJvgWPxSZNKUWdv0zywS6TEdWBrDACb1ejow015MpjC5z8iomx/dm3eCXLF3X72QKwc7QQ2y1L6lHzlQj0v4TlmmBaY8kzLVOlR/PPlq3r/UK+P9Wj9Z9cLFXF3TiHaLgLtgtWfD9VeVqu8AHJ+bRZEWPmJA2cQULEcw4bH5sI5MoBvtsGJKMdGGH8+WzslGVZFBTzHSPqdv6gmdmWCoWBjBsbXFbVxqvclE8djrnJXSKMO6zzJDUlJv0hrWiUgjQ5xgcTdD74xF+2K5OJXQN1HdbGS0fafjainXpOdyzMIvzRGlt5iqiKeKb61iJUcCqEFM6d7mcp6xON1dKzH0b0xwCgRb6QamyAeem6iWi2JQB5V2SkjkXJt7V4HZa115Uv87HRq9hNiZRJMnHDd5D6zaO5f8fEjgouJ8foQ6eH14RFx/tcU5G74ywm5U+LB2siQYolqyrrIlJAOYlowZ6nPpJ1E/FEfhi1En2j0IPrKXN1VLSZH06hvtFOEri5n9p6Esr3Lu6eJt47KBLss2mIWsZy9HY=--+btNg5DzqAF8hoIg--GEDJfW0wHUvsu5uUhzeYOg== \ No newline at end of file +feYwnyPhKhFhBPrbNaFKJ/T4w93VDiaE8f7WZ1zu8mtTIIj40XIUhAqgLx9egKMvaqnUDEXjkcPEePhMExQLF0lleJvB7C3O4T8vvdqHlbNEZv7e9i387D0unlidlfDJqRSf/ij/nQ4ag8eCjV3hqhxm/fyCR3syhF393uvUbBo0RjeEW6vf7FaEB8R/Zk9LWfWUuGPIkS49ht644cK9z4UZ/r86ERkRmJciz4geO97lQmBP6yKW8V6XJkP5zRds+W83ux+x1+iM0xL3Z6SuXStmHo2MdiaBWMIpxAE6HsuUJGrshZtIumimRJ1ou+BVKtAbJ2shZWUOL1hjC8zOCXDnWd2ok85OEskP4+itdGgr1zGj/hWyQIdcBIp9dJJeKlOujyyaO0z35mwO3ibH4b4NRcMKbhVHTeHqrbM/24AzV2tMzA+W2Je+VDavXNwBFe4h34ZwEA+5gBv37QnHytGOsIf/gxaaLFxRe4/IWjJDrqY5SULhXxh0nSHqo2WJCvDquTmCd6TtyUTItvq8tiU8l/cpExNaAKuwcxyLkyOtIb9MrdY11XAk0znHSd6cvXqS3nyWy0wkGr2bd70CdpmO615aPlHXjf5YKWY3bpJqhfLnmlW8CkFZL/qMer4M1qMwZ0M8wKfm617Z081N59ZIzLw7H0Ypzsgc2yQDTcMQCWtxoQmHxVYC9+2up8znZm/R02rjeaRldRLHPnnH9az70bNqzbVKO+/4NkMOiIsKDjx2VoruavaOeJxTdTBl6Y4WKsV+TG0GDtutzm+DEeUteE1aTAgXEtHweVevgI9vHIKVbQPexOZ4yEN+2AZm+W2sJxbjk1YkAj9eFsC1Nt3oapOHZkOqqYA/QUQXJ5gzj1a51LcY/efM3Rwd90q3LaFPRfLNxfmHrtWHXvciROScKih2r6hHMbtNEAtaPbz3r7BICI+ALCgNflbiPfJZesDUvEE3RTbj+WzpWeTzJY7xT4lBsrSJT7uKz74Sp0rmSL4aHRI3rsj6YnZEIxPHzQ==--vF6peKEukVgJhOM9--mB45egvWtI47mU9i1SeB4A== \ No newline at end of file From f28c204411a7a12eb7b79cf81b84b7b28731a794 Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Thu, 27 Mar 2025 18:50:01 -0400 Subject: [PATCH 06/17] Enhance mailer layout for Bear River Writers' Conference - Updated the mailer layout to include improved styling and structure for better readability. - Added a container for the email content, a header with an optional logo, and a footer with contact information and copyright notice. - Changed the conference name to a clickable link for easier access to the website. --- app/views/layouts/mailer.html.erb | 64 ++++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 10 deletions(-) diff --git a/app/views/layouts/mailer.html.erb b/app/views/layouts/mailer.html.erb index 8260180..647aab9 100644 --- a/app/views/layouts/mailer.html.erb +++ b/app/views/layouts/mailer.html.erb @@ -1,19 +1,63 @@ - - - - - + + + + + +
+
+ + +

Bear River Writers' Conference

+
+ <%= yield %> +
-

Bear River Writers' Conference

+

<%= link_to "Bear River Writers' Conference", "https://lsa.umich.edu/bearriver" %>

3187 Angell Hall
435 South State Street
Ann Arbor, MI 48109-1003

- - \ No newline at end of file +

+ If you have any questions, please contact <%= mail_to "bearriver-questions@umich.edu", "bearriver-questions@umich.edu" %> +

+ +
+ + From a09b4970cd2654cbdd184abfbb22c782885a13a6 Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Thu, 27 Mar 2025 18:50:10 -0400 Subject: [PATCH 07/17] Enhance mailer layout for Bear River Writers' Conference - Added a footer with contact information and a copyright notice. - Included a clickable link to the conference website for easier access. - Improved overall structure and readability of the mailer layout. --- app/views/layouts/mailer.text.erb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/mailer.text.erb b/app/views/layouts/mailer.text.erb index 08e9303..8847ad7 100644 --- a/app/views/layouts/mailer.text.erb +++ b/app/views/layouts/mailer.text.erb @@ -1,5 +1,15 @@ -<%= yield %> Bear River Writers' Conference +============================= + +<%= yield %> + +Bear River Writers' Conference - https://lsa.umich.edu/bearriver 3187 Angell Hall 435 South State Street -Ann Arbor, MI 48109-1003 \ No newline at end of file +Ann Arbor, MI 48109-1003 + +If you have any questions, please contact bearriver-questions@umich.edu + +--- +This is an automated email. Please do not reply to this message. +© <%= Date.today.year %> The Regents of the University of Michigan | All Rights Reserved From f36f778e4e9235153c3cb91e06bdcfb0f2f0d567 Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Thu, 27 Mar 2025 18:50:39 -0400 Subject: [PATCH 08/17] Refactor application submitted email templates - Simplified the HTML and text email templates by removing unnecessary markup. - Retained the core message and link to the Bear River Conference site for clarity and ease of access. --- .../application_submitted.html.erb | 19 +++---------------- .../application_submitted.text.erb | 8 +------- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/app/views/app_confirmation_mailer/application_submitted.html.erb b/app/views/app_confirmation_mailer/application_submitted.html.erb index 1353d9b..dab77cc 100644 --- a/app/views/app_confirmation_mailer/application_submitted.html.erb +++ b/app/views/app_confirmation_mailer/application_submitted.html.erb @@ -1,16 +1,3 @@ - - - - - - - -

- <%= @current_application_settings.application_confirm_email_message %> -

-

- <%= link_to "Bear River Conference site", "https://lsa.umich.edu/bearriver" %> -

-

Thank you,

- - +

+ <%= @current_application_settings.application_confirm_email_message %> +

diff --git a/app/views/app_confirmation_mailer/application_submitted.text.erb b/app/views/app_confirmation_mailer/application_submitted.text.erb index 0a76aee..2b080cd 100644 --- a/app/views/app_confirmation_mailer/application_submitted.text.erb +++ b/app/views/app_confirmation_mailer/application_submitted.text.erb @@ -1,7 +1 @@ -

- <%= @current_application_settings.application_confirm_email_message %> -

-

- <%= link_to "Bear River Conference site", "https://lsa.umich.edu/bearriver" %> -

-

Thank you,

\ No newline at end of file +<%= @current_application_settings.application_confirm_email_message %> From 42b239497682fd8ab2a82e4524a924af0239ce17 Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Thu, 27 Mar 2025 18:50:57 -0400 Subject: [PATCH 09/17] Refactor outstanding balance email templates - Simplified the HTML and text email templates by removing unnecessary markup and improving readability. - Updated the link text for clarity, directing users to the Bear River payments page. --- .../outstanding_balance.html.erb | 21 ++++++------------- .../outstanding_balance.text.erb | 4 +--- 2 files changed, 7 insertions(+), 18 deletions(-) diff --git a/app/views/balance_due_mailer/outstanding_balance.html.erb b/app/views/balance_due_mailer/outstanding_balance.html.erb index d9ebfa5..494e687 100644 --- a/app/views/balance_due_mailer/outstanding_balance.html.erb +++ b/app/views/balance_due_mailer/outstanding_balance.html.erb @@ -1,15 +1,6 @@ - - - - - - -

- <%= @current_application_settings.balance_due_email_message %> -

-

- <%= link_to "Bear River site", payments_url %> -

-

Thank you,

- - +

+ <%= @current_application_settings.balance_due_email_message %> +

+

+ <%= link_to "Bear River payments", payments_url %> +

diff --git a/app/views/balance_due_mailer/outstanding_balance.text.erb b/app/views/balance_due_mailer/outstanding_balance.text.erb index c40ffc3..d92ba7e 100644 --- a/app/views/balance_due_mailer/outstanding_balance.text.erb +++ b/app/views/balance_due_mailer/outstanding_balance.text.erb @@ -1,5 +1,3 @@ <%= @current_application_settings.balance_due_email_message %> -<%= link_to "Bear River site", payments_url %> - -Thank you, +Bear River payments https://bearriver.lsa.umich.edu From 505d50fbb37ceedea56c9e2202b7a5a726ac4125 Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Thu, 27 Mar 2025 18:51:48 -0400 Subject: [PATCH 10/17] Refactor lost lottery email template - Simplified the HTML structure by removing unnecessary tags, enhancing readability while retaining the core message. - Improved the overall layout for a cleaner presentation of the email content. --- .../lost_lottery_email.html.erb | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/app/views/lottery_mailer/lost_lottery_email.html.erb b/app/views/lottery_mailer/lost_lottery_email.html.erb index 44896e9..ffd1e88 100644 --- a/app/views/lottery_mailer/lost_lottery_email.html.erb +++ b/app/views/lottery_mailer/lost_lottery_email.html.erb @@ -1,15 +1,7 @@ - - - - - - -

- Hello <%= @application.first_name %> <%= @application.last_name %>, -

-

- <%= @lottery_lost_mail_body %> -

-

We thank you for your interest in Bear River.

- - +

+ Hello <%= @application.first_name %> <%= @application.last_name %>, +

+

+ <%= @lottery_lost_mail_body %> +

+

We thank you for your interest in Bear River.

From 665dc91b66156880a1d3a1a2afe24634f22bb872 Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Thu, 27 Mar 2025 18:52:17 -0400 Subject: [PATCH 11/17] Refactor pre-lottery offer email template - Simplified the HTML structure by removing unnecessary tags, enhancing readability while retaining the core message. - Improved the overall layout for a cleaner presentation of the email content. --- .../pre_lottery_offer_email.html.erb | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/app/views/lottery_mailer/pre_lottery_offer_email.html.erb b/app/views/lottery_mailer/pre_lottery_offer_email.html.erb index f247bd1..0ab53f3 100644 --- a/app/views/lottery_mailer/pre_lottery_offer_email.html.erb +++ b/app/views/lottery_mailer/pre_lottery_offer_email.html.erb @@ -1,18 +1,10 @@ - - - - - - -

- Congratulations <%= @application.first_name %> <%= @application.last_name %>! -

-

- <%= @special_offer_invite_email_body %> -

-

- <%= link_to "Accept Offer", accept_offer_url %> -

-

We look forward to you joining us at Bear River!

- - +

+ Congratulations <%= @application.first_name %> <%= @application.last_name %>! +

+

+ <%= @special_offer_invite_email_body %> +

+

+ <%= link_to "Accept Offer", accept_offer_url %> +

+

We look forward to you joining us at Bear River!

From 6e5dd3d29b94d037193831f7cf05c6fb96fb5691 Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Thu, 27 Mar 2025 18:52:48 -0400 Subject: [PATCH 12/17] Refactor waitlisted offer email template - Simplified the HTML structure by removing unnecessary tags, enhancing readability while retaining the core message. - Improved the overall layout for a cleaner presentation of the email content. --- .../waitlisted_offer_email.html.erb | 28 +++++++------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/app/views/lottery_mailer/waitlisted_offer_email.html.erb b/app/views/lottery_mailer/waitlisted_offer_email.html.erb index f247bd1..0ab53f3 100644 --- a/app/views/lottery_mailer/waitlisted_offer_email.html.erb +++ b/app/views/lottery_mailer/waitlisted_offer_email.html.erb @@ -1,18 +1,10 @@ - - - - - - -

- Congratulations <%= @application.first_name %> <%= @application.last_name %>! -

-

- <%= @special_offer_invite_email_body %> -

-

- <%= link_to "Accept Offer", accept_offer_url %> -

-

We look forward to you joining us at Bear River!

- - +

+ Congratulations <%= @application.first_name %> <%= @application.last_name %>! +

+

+ <%= @special_offer_invite_email_body %> +

+

+ <%= link_to "Accept Offer", accept_offer_url %> +

+

We look forward to you joining us at Bear River!

From aee1dec98bd6de4e00da0d3ba12916ba1793dccb Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Thu, 27 Mar 2025 18:53:12 -0400 Subject: [PATCH 13/17] Refactor lottery winner email templates - Simplified the HTML and text email structures by removing unnecessary tags, enhancing readability while retaining the core message. - Improved overall layout for a cleaner presentation of the email content. --- .../lottery_mailer/won_lottery_email.html.erb | 31 ++++++------------- .../lottery_mailer/won_lottery_email.text.erb | 23 +++++--------- 2 files changed, 17 insertions(+), 37 deletions(-) diff --git a/app/views/lottery_mailer/won_lottery_email.html.erb b/app/views/lottery_mailer/won_lottery_email.html.erb index 256bb18..bf3890f 100644 --- a/app/views/lottery_mailer/won_lottery_email.html.erb +++ b/app/views/lottery_mailer/won_lottery_email.html.erb @@ -1,21 +1,10 @@ - - - - - - -

- Congratulations <%= @application.first_name %> <%= @application.last_name %>! -

-

- <%= @lottery_won_mail_body %> -

-

- <%= link_to "Accept Offer", accept_offer_url %> -

-

- We look forward to you joining us at Bear River! -

- - - +

+ Congratulations <%= @application.first_name %> <%= @application.last_name %>! +

+

+ <%= @lottery_won_mail_body %> +

+

+ <%= link_to "Accept Offer", accept_offer_url %> +

+

We look forward to you joining us at Bear River!

diff --git a/app/views/lottery_mailer/won_lottery_email.text.erb b/app/views/lottery_mailer/won_lottery_email.text.erb index c5c6de6..757fe4f 100644 --- a/app/views/lottery_mailer/won_lottery_email.text.erb +++ b/app/views/lottery_mailer/won_lottery_email.text.erb @@ -1,16 +1,7 @@ - - - - - - -

- Congratulations #{@application.first_name} #{@application.last_name}! -

- <%= @lottery_won_mail_body %> - <%= link_to "Accept Offer", accept_offer_url %> -

- We look forward to you joining us at Bear River! -

- - +Congratulations #{@application.first_name} #{@application.last_name}! + +<%= @lottery_won_mail_body %> + +<%= link_to "Accept Offer", accept_offer_url %> + +We look forward to you joining us at Bear River! From 08528c174b1041aeb02da3b0b483f7c9b8b08a22 Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Thu, 27 Mar 2025 18:53:34 -0400 Subject: [PATCH 14/17] Add TestMailer for email configuration verification - Introduced TestMailer class to facilitate testing of email configurations. - Implemented test_email method to send a test email with a predefined message and sender information. - Default recipient set to a specified test email address for verification purposes. --- app/mailers/test_mailer.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 app/mailers/test_mailer.rb diff --git a/app/mailers/test_mailer.rb b/app/mailers/test_mailer.rb new file mode 100644 index 0000000..de53325 --- /dev/null +++ b/app/mailers/test_mailer.rb @@ -0,0 +1,12 @@ +class TestMailer < ApplicationMailer + def test_email(recipient_email = nil) + @message = 'This is a test email from LSA Evaluate to verify email configuration.' + @sender = Rails.application.config.mailer_sender + @reply_to = 'lsa-wads-rails-email-test@umich.edu' + + mail( + to: recipient_email || 'lsa-wads-rails-email-test@umich.edu', + subject: 'Test Email from LSA Evaluate' + ) + end +end From 4a429375b3c9bb1d4ace0c80b94554281aeba756 Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Thu, 27 Mar 2025 18:53:57 -0400 Subject: [PATCH 15/17] Add test email templates for email configuration verification - Created HTML and text email templates for the TestMailer to confirm email settings. - Included dynamic placeholders for message, sender, and reply-to information. - Ensured clarity and professionalism in the email content for user communication. --- app/views/test_mailer/test_email.html.erb | 14 ++++++++++++++ app/views/test_mailer/test_email.text.erb | 13 +++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 app/views/test_mailer/test_email.html.erb create mode 100644 app/views/test_mailer/test_email.text.erb diff --git a/app/views/test_mailer/test_email.html.erb b/app/views/test_mailer/test_email.html.erb new file mode 100644 index 0000000..f5ab9fd --- /dev/null +++ b/app/views/test_mailer/test_email.html.erb @@ -0,0 +1,14 @@ +

Email Configuration Test

+ +

<%= @message %>

+ +

This message confirms your email settings are working correctly.

+ +

Email Configuration:

+
    +
  • From: <%= @sender %>
  • +
  • Reply-To: <%= @reply_to %>
  • +
+ +

This is a system-generated email. Please do not reply directly to this message.

+

If you need assistance, please contact <%= @reply_to %>.

diff --git a/app/views/test_mailer/test_email.text.erb b/app/views/test_mailer/test_email.text.erb new file mode 100644 index 0000000..2dc18b4 --- /dev/null +++ b/app/views/test_mailer/test_email.text.erb @@ -0,0 +1,13 @@ +Email Configuration Test +====================== + +<%= @message %> + +This message confirms your email settings are working correctly. + +Email Configuration: +- From: <%= @sender %> +- Reply-To: <%= @reply_to %> + +This is a system-generated email. Please do not reply directly to this message. +If you need assistance, please contact <%= @reply_to %>. From 3b51bf58669be6abb679f8f460078f9d8039d22a Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Thu, 27 Mar 2025 18:54:06 -0400 Subject: [PATCH 16/17] Add Rake task for sending test emails - Introduced a new Rake task under the email namespace to facilitate sending test emails for configuration verification. - Allows users to choose between direct email delivery and queuing via Sidekiq. - Includes error handling and informative output for successful or failed email sending attempts. --- lib/tasks/email.rake | 60 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 lib/tasks/email.rake diff --git a/lib/tasks/email.rake b/lib/tasks/email.rake new file mode 100644 index 0000000..e0e651f --- /dev/null +++ b/lib/tasks/email.rake @@ -0,0 +1,60 @@ +namespace :email do + # You can choose whether to queue the email through Sidekiq or send it directly: + # For direct delivery: + # bin/rails email:test[your@email.com] + # + # To queue through Sidekiq (add true as a second argument): + # bin/rails email:test[your@email.com,true] + + desc 'Send a test email to verify configuration' + task :test, [ :email, :queue ] => :environment do |_t, args| + recipient = args[:email] || Rails.application.credentials.dig(:devise, :mailer_sender) + + # Check if Sidekiq is available + sidekiq_available = defined?(Sidekiq) == 'constant' && Sidekiq.class == Module + queue_delivery_requested = args[:queue]&.downcase == 'true' + + # Set queue_delivery to false if Sidekiq is not available + queue_delivery = queue_delivery_requested && sidekiq_available + + # Show a warning if user requested Sidekiq but it's not available + if queue_delivery_requested && !sidekiq_available + puts "WARNING: Sidekiq is not available. Email will be sent directly." + end + + if recipient.nil? + puts 'ERROR: No recipient email provided and no default contact email configured.' + puts 'Usage: rake email:test[recipient@example.com] or rake email:test[recipient@example.com,true] to queue via Sidekiq' + exit 1 + end + + puts "Sending test email to #{recipient}..." + begin + if queue_delivery + # For queued delivery, don't inspect the message before sending + puts 'Queuing email delivery through Sidekiq...' + TestMailer.test_email(recipient).deliver_later + puts 'Email successfully queued in Sidekiq!' + else + # For direct delivery, we can inspect the message + mail = TestMailer.test_email(recipient) + + # Print message details before sending + puts 'Message details:' + puts " From: #{mail.from.first || 'Not set'}" + puts " Reply-To: #{mail.reply_to&.first || 'Not set'}" + puts " Subject: #{mail.subject || 'Not set'}" + puts 'Headers:' + mail.header.fields.each do |field| + puts " #{field.name}: #{field.value}" unless field.name =~ /content-/i + end + + mail.deliver_now + puts 'Test email sent directly (bypassing Sidekiq)!' + end + rescue => e + puts "ERROR: Failed to send test email: #{e.message}" + puts e.backtrace.join("\n") + end + end +end From 194ebb079c72fcd7731990b20046df43216d53ea Mon Sep 17 00:00:00 2001 From: rsmokeUM Date: Thu, 27 Mar 2025 19:28:00 -0400 Subject: [PATCH 17/17] Update lottery email templates to replace link_to with direct URL - Modified pre-lottery, waitlisted, and won lottery email templates to replace the dynamic link with a static URL for accepting offers. - Ensured consistency in messaging across all lottery-related communications. --- app/views/lottery_mailer/pre_lottery_offer_email.text.erb | 2 +- app/views/lottery_mailer/waitlisted_offer_email.text.erb | 2 +- app/views/lottery_mailer/won_lottery_email.text.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/views/lottery_mailer/pre_lottery_offer_email.text.erb b/app/views/lottery_mailer/pre_lottery_offer_email.text.erb index cc7fbf6..0bbebee 100644 --- a/app/views/lottery_mailer/pre_lottery_offer_email.text.erb +++ b/app/views/lottery_mailer/pre_lottery_offer_email.text.erb @@ -2,6 +2,6 @@ Congratulations <%= @application.first_name %> <%= @application.last_name %>! <%= @special_offer_invite_email_body %> -<%= link_to "Accept Offer", accept_offer_url %> +Accept Offer -> https://bearriver.lsa.umich.edu/accept_offer We look forward to you joining us at Bear River! diff --git a/app/views/lottery_mailer/waitlisted_offer_email.text.erb b/app/views/lottery_mailer/waitlisted_offer_email.text.erb index cc7fbf6..0bbebee 100644 --- a/app/views/lottery_mailer/waitlisted_offer_email.text.erb +++ b/app/views/lottery_mailer/waitlisted_offer_email.text.erb @@ -2,6 +2,6 @@ Congratulations <%= @application.first_name %> <%= @application.last_name %>! <%= @special_offer_invite_email_body %> -<%= link_to "Accept Offer", accept_offer_url %> +Accept Offer -> https://bearriver.lsa.umich.edu/accept_offer We look forward to you joining us at Bear River! diff --git a/app/views/lottery_mailer/won_lottery_email.text.erb b/app/views/lottery_mailer/won_lottery_email.text.erb index 757fe4f..f0a9103 100644 --- a/app/views/lottery_mailer/won_lottery_email.text.erb +++ b/app/views/lottery_mailer/won_lottery_email.text.erb @@ -2,6 +2,6 @@ Congratulations #{@application.first_name} #{@application.last_name}! <%= @lottery_won_mail_body %> -<%= link_to "Accept Offer", accept_offer_url %> +Accept Offer -> https://bearriver.lsa.umich.edu/accept_offer We look forward to you joining us at Bear River!