7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/letter_opener_web/delivery_method.rb', line 7
def deliver!(mail)
original = ENV.fetch('LAUNCHY_DRY_RUN', nil)
ENV['LAUNCHY_DRY_RUN'] = 'true'
if LetterOpenerWeb.config.letters_storage == :s3
validate_mail!(mail)
location = File.join(
settings[:location],
"#{Time.now.to_f.to_s.tr('.', '_')}_#{Digest::SHA1.hexdigest(mail.encoded)[0..6]}"
)
LetterOpenerWeb::S3Message.rendered_messages(mail, location:,
message_template: settings[:message_template])
else
super
end
rescue Launchy::CommandNotFoundError
ensure
ENV['LAUNCHY_DRY_RUN'] = original
end
|