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

Change email subject and receivers #75

Merged
merged 1 commit into from
Mar 9, 2020
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
2 changes: 1 addition & 1 deletion .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ ADMIN_USERNAME=test
ADMIN_PASSWORD=password

# Mail Variables
MAIL_SENDER=norrisms@ucmail.uc.edu
MAIL_SENDER=sender@invalid.com
3 changes: 2 additions & 1 deletion app/mailers/publication_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class PublicationMailer < ApplicationMailer
def publication_submit(submitter, publication)
@submitter = submitter
@publication = publication
mail(to: submitter.email_address, subject: 'AAEC - Publication received')
receivers = "#{submitter.email_address}, #{ENV['MAIL_SENDER']}"
mail(to: receivers, subject: 'Publication received for Artists, Authors, Editors & Composers')
end
end
4 changes: 2 additions & 2 deletions spec/mailers/publication_mailer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
it 'sends an email for a book' do
book = FactoryBot.create(:book)
mail = described_class.publication_submit(submitter, book).deliver_now
expect(mail.subject).to eq('AAEC - Publication received')
expect(mail.to).to eq([submitter.email_address])
expect(mail.subject).to eq('Publication received for Artists, Authors, Editors & Composers')
expect(mail.to).to eq([submitter.email_address, ENV['MAIL_SENDER']])
expect(mail.from).to eq([ENV['MAIL_SENDER']])
expect(mail.body.encoded).to match(book.work_title)
expect(mail.body.encoded).to match('Please include an address where I may return your publication')
Expand Down