Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMR-9842: Changing Sub/Not email to use EMCC AWS SES. #2172

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions ingest-app/src/cmr/ingest/services/subscriptions_helper.clj
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,27 @@

(defconfig email-server-port
"The port number for email server."
{:default 25
{:default 465
:type Long})

(defconfig ses-user
"The port number for email server."
{:default ""
:type String})

(defconfig ses-password
"The port number for email server."
{:default ""
:type String})

(defconfig subscriptions-limit
"The subscription limit for a single non-admin subscriber id."
{:default 100
:type Long})

(defconfig mail-sender
(defconfig ses-mail-sender
"The email sender's email address."
{:default ""
{:default "[email protected]"
:type String})

(defconfig email-subscription-processing-interval
Expand Down Expand Up @@ -243,8 +253,13 @@
(when (seq subscriber-filtered-concept-refs)
(let [concept-ref-locations (map :location subscriber-filtered-concept-refs)
email-address (urs/get-user-email context subscriber-id)
email-content (create-email-content sub-type (mail-sender) email-address concept-ref-locations subscription)
email-settings {:host (email-server-host) :port (email-server-port)}]
email-content (create-email-content sub-type (ses-mail-sender) email-address concept-ref-locations subscription)
email-settings {:host (email-server-host)
:port (email-server-port)
:user (ses-user)
:pass (ses-password)
:ssl true
:type "text/html; charset=utf-8"}]
(try
(send-email email-settings email-content)
(info (str "Successfully processed subscription [" sub-id "].
Expand Down