Skip to content
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ this automatically. It is often nice in development as well.
### Development

`MAINTAINER_EMAIL` - used for `to` field of virus detected emails.
`THESIS_ADMIN_EMAIL` - used for `from` field of receipt emails. Also the email to which reports are sent.
`ETD_APP_EMAIL` - used for `from` field of receipt emails.
`THESIS_ADMIN_EMAIL` - the email to which reports are sent.
`MAINTAINER_EMAIL` - used for `cc` field of report emails.
`SCOUT_DEV_TRACE` - include this and set it to `true` to enable perfomance monitoring in development. Very useful to
track down N+1 queries!
Expand Down
2 changes: 1 addition & 1 deletion app/mailers/application_mailer.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ApplicationMailer < ActionMailer::Base
default from: ENV['THESIS_ADMIN_EMAIL']
default from: ENV['ETD_APP_EMAIL']
layout 'mailer'
end
4 changes: 2 additions & 2 deletions app/mailers/batch_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def marc_batch_email(marc_zip_filename, marc_zip_file, theses)

@theses = theses
attachments[marc_zip_filename.to_s] = File.binread(marc_zip_file)
mail(from: "MIT Libraries <#{ENV['THESIS_ADMIN_EMAIL']}>",
mail(from: "MIT Libraries <#{ENV['ETD_APP_EMAIL']}>",
to: ENV['METADATA_ADMIN_EMAIL'],
cc: ENV['MAINTAINER_EMAIL'],
subject: 'ETD MARC batch export')
Expand All @@ -18,7 +18,7 @@ def proquest_export_email(json_blob, thesis_count)
mime_type: json_blob.content_type,
content: json_blob.download
}
mail(from: "MIT Libraries <#{ENV['THESIS_ADMIN_EMAIL']}>",
mail(from: "MIT Libraries <#{ENV['ETD_APP_EMAIL']}>",
to: ENV['THESIS_ADMIN_EMAIL'],
cc: ENV['MAINTAINER_EMAIL'],
subject: 'ETD ProQuest export')
Expand Down
6 changes: 3 additions & 3 deletions app/mailers/receipt_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def receipt_email(thesis, user)

@user = user
@thesis = thesis
mail(from: "MIT Libraries <#{ENV['THESIS_ADMIN_EMAIL']}>",
mail(from: "MIT Libraries <#{ENV['ETD_APP_EMAIL']}>",
to: @user.email,
subject: 'Your thesis information submission')
end
Expand All @@ -16,7 +16,7 @@ def transfer_receipt_email(transfer, user)

@user = user
@transfer = transfer
mail(from: "MIT Libraries <#{ENV['THESIS_ADMIN_EMAIL']}>",
mail(from: "MIT Libraries <#{ENV['ETD_APP_EMAIL']}>",
to: @user.email,
cc: ENV['THESIS_ADMIN_EMAIL'],
subject: 'Thesis files transferred')
Expand All @@ -26,7 +26,7 @@ def virus_detected_email(transfer)
return unless ENV.fetch('DISABLE_ALL_EMAIL', 'true') == 'false' # allows PR builds to disable emails

@transfer = transfer
mail(from: "MIT Libraries <#{ENV['THESIS_ADMIN_EMAIL']}>",
mail(from: "MIT Libraries <#{ENV['ETD_APP_EMAIL']}>",
to: ENV['MAINTAINER_EMAIL'],
cc: ENV['THESIS_ADMIN_EMAIL'],
subject: 'Thesis files with virus detected')
Expand Down
4 changes: 2 additions & 2 deletions app/mailers/report_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def registrar_import_email(registrar, results)

@registrar = registrar
@results = results
mail(from: "MIT Libraries <#{ENV['THESIS_ADMIN_EMAIL']}>",
mail(from: "MIT Libraries <#{ENV['ETD_APP_EMAIL']}>",
to: ENV['THESIS_ADMIN_EMAIL'],
cc: ENV['MAINTAINER_EMAIL'],
subject: 'Registrar data import summary')
Expand All @@ -14,7 +14,7 @@ def publication_results_email(results)
return unless ENV.fetch('DISABLE_ALL_EMAIL', 'true') == 'false' # allows PR builds to disable emails

@results = results
mail(from: "MIT Libraries <#{ENV['THESIS_ADMIN_EMAIL']}>",
mail(from: "MIT Libraries <#{ENV['ETD_APP_EMAIL']}>",
to: ENV['THESIS_ADMIN_EMAIL'],
cc: ENV['MAINTAINER_EMAIL'],
subject: 'DSpace publication results summary')
Expand Down
1 change: 1 addition & 0 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
ENV['SP_PRIVATE_KEY'] = ''
ENV['SP_CERTIFICATE'] = ''
ENV['THESIS_ADMIN_EMAIL'] = 'test@example.com'
ENV['ETD_APP_EMAIL'] = 'app@example.com'
ENV['METADATA_ADMIN_EMAIL'] = 'test-metadata@example.com'
ENV['SQS_INPUT_QUEUE_URL'] = 'http://localhost:5000/123456789012/etd-test-input'
ENV['SQS_OUTPUT_QUEUE_NAME'] = 'etd-test-output'
Expand Down
4 changes: 2 additions & 2 deletions test/mailers/batch_mailer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class BatchMailerTest < ActionMailer::TestCase
end

# Make sure it was sent to the right person with the expected attachment.
assert_equal ['test@example.com'], email.from
assert_equal ['app@example.com'], email.from
assert_equal ['test-metadata@example.com'], email.to
assert_equal 'ETD MARC batch export', email.subject
assert_equal 'marc.zip', email.attachments.first.filename
Expand Down Expand Up @@ -48,7 +48,7 @@ class BatchMailerTest < ActionMailer::TestCase
end

# Make sure it was sent to the right person with the expected attachment.
assert_equal ['test@example.com'], email.from
assert_equal ['app@example.com'], email.from
assert_equal ['test@example.com'], email.to
assert_equal 'ETD ProQuest export', email.subject
assert_equal 'pq.json', email.attachments.first.filename
Expand Down
4 changes: 2 additions & 2 deletions test/mailers/receipt_mailer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ReceiptMailerTest < ActionMailer::TestCase
end

# Test the body of the sent email contains what we expect it to
assert_equal ['test@example.com'], email.from
assert_equal ['app@example.com'], email.from
assert_equal ['admin@example.com'], email.to
assert_equal 'Your thesis information submission', email.subject
assert_equal read_fixture('receipt_email').join, email.body.to_s
Expand Down Expand Up @@ -64,7 +64,7 @@ class ReceiptMailerTest < ActionMailer::TestCase
end

# Test the body of the sent email contains what we expect it to
assert_equal ['test@example.com'], email.from
assert_equal ['app@example.com'], email.from
assert_equal ['transfer@example.com'], email.to
assert_equal 'Thesis files transferred', email.subject
# Please note: we are not attempting to assert_equal on the entire
Expand Down
4 changes: 2 additions & 2 deletions test/mailers/report_mailer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ReportMailerTest < ActionMailer::TestCase

# Make sure it was sent to the right person with the right content. We are only testing a subset of the body
# rather than a full sample email to avoid future testing complications
assert_equal ['test@example.com'], email.from
assert_equal ['app@example.com'], email.from
assert_equal ['test@example.com'], email.to
assert_equal 'Registrar data import summary', email.subject
assert_match 'New theses: 1', email.body.to_s
Expand All @@ -32,7 +32,7 @@ class ReportMailerTest < ActionMailer::TestCase
email.deliver_now
end

assert_equal ['test@example.com'], email.from
assert_equal ['app@example.com'], email.from
assert_equal ['test@example.com'], email.to
assert_equal 'DSpace publication results summary', email.subject.to_s
assert_match 'Total theses in output queue: 2', email.body.to_s
Expand Down