Skip to content

Resending Outgoing Message followup to a new email address

Gareth Rees edited this page Sep 26, 2017 · 3 revisions

e.g. if the authority provides a separate internal review address that we don't have

# Replace with intended values
#
MESSAGE_ID = 0
EMAIL_ADDRESS = '[email protected]'
#
#

@outgoing_message = OutgoingMessage.find(MESSAGE_ID)

def @outgoing_message.to
  EMAIL_ADDRESS
end

@outgoing_message.prepare_message_for_resend

mail_message = OutgoingMailer.followup(
  @outgoing_message.info_request,
  @outgoing_message,
  @outgoing_message.incoming_message_followup
).deliver_now

@outgoing_message.record_email_delivery(
  mail_message.to_addrs.join(', '),
  mail_message.message_id,
  'resent'
)
Clone this wiki locally