-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged in feature/configure_mailer_settings (pull request #16)
KBP-137 Feature/configure mailer settings Approved-by: Eşref VİDUŞLU <esref.viduslu@lab2023.com> Approved-by: İsmail Akbudak <ismail.akbudak@lab2023.com>
- Loading branch information
Showing
13 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# frozen_string_literal: true | ||
|
||
module Cybele | ||
module Helpers | ||
module Mailer | ||
def configure_action_mailer | ||
action_mailer_host 'development' | ||
action_mailer_host 'staging' | ||
action_mailer_host 'production' | ||
end | ||
|
||
def configure_smtp | ||
configure_environment 'staging', | ||
template_content('recipient_interceptor/recipient_interceptor_staging.rb.erb') | ||
configure_environment 'production', template_content('mailer/smtp.rb.erb') | ||
configure_environment 'staging', template_content('mailer/smtp.rb.erb') | ||
append_file 'config/settings.yml', template_content('mailer/mailer_settings.yml.erb') | ||
end | ||
|
||
def setup_letter_opener | ||
configure_environment 'development', template_content('mailer/letter_opener.rb.erb') | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
module MailTestHelpers | ||
def mail_test_helper(path) | ||
file = content(path) | ||
expect(file).to match('smtp') | ||
expect(file).to match('address:') | ||
expect(file).to match('port:') | ||
expect(file).to match('enable_starttls_auto:') | ||
expect(file).to match('user_name:') | ||
expect(file).to match('password:') | ||
expect(file).to match('authentication:') | ||
unless content('config/settings.yml').present? | ||
expect(file).to match('host:') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Mail Setting | ||
config.action_mailer.default_url_options = { host: ENV['ROOT_PATH'] } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
config.action_mailer.delivery_method = :letter_opener |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
root_path: <%= ENV['ROOT_PATH'] %> | ||
|
||
smtp: | ||
address: <%= ENV['SMTP_ADDRESS'] %> | ||
port: 587 | ||
enable_starttls_auto: true | ||
user_name: <%= ENV['SMTP_USER_NAME'] %> | ||
password: <%= ENV['SMTP_PASSWORD'] %> | ||
authentication: 'plain' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
config.action_mailer.delivery_method = :smtp | ||
config.action_mailer.raise_delivery_errors = false | ||
config.action_mailer.smtp_settings = { | ||
address: Settings.smtp.address, | ||
port: Settings.smtp.port, | ||
enable_starttls_auto: Settings.smtp.enable_starttls_auto, | ||
user_name: Settings.smtp.user_name, | ||
password: Settings.smtp.password, | ||
authentication: Settings.smtp.authentication | ||
} |