From c8e2492d746c0e782e1af8df11a3d7080974c6af Mon Sep 17 00:00:00 2001 From: Glen Horton Date: Fri, 6 Mar 2020 22:32:12 -0500 Subject: [PATCH] Change email subject and receivers --- .env.development | 2 +- app/mailers/publication_mailer.rb | 3 ++- spec/mailers/publication_mailer_spec.rb | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.env.development b/.env.development index 5f946b8b..23859502 100644 --- a/.env.development +++ b/.env.development @@ -3,4 +3,4 @@ ADMIN_USERNAME=test ADMIN_PASSWORD=password # Mail Variables -MAIL_SENDER=norrisms@ucmail.uc.edu \ No newline at end of file +MAIL_SENDER=sender@invalid.com diff --git a/app/mailers/publication_mailer.rb b/app/mailers/publication_mailer.rb index 75daefdc..20c9ddb7 100644 --- a/app/mailers/publication_mailer.rb +++ b/app/mailers/publication_mailer.rb @@ -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 diff --git a/spec/mailers/publication_mailer_spec.rb b/spec/mailers/publication_mailer_spec.rb index 53fce6f8..5d416aed 100644 --- a/spec/mailers/publication_mailer_spec.rb +++ b/spec/mailers/publication_mailer_spec.rb @@ -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')