6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/actionmailer_extensions.rb', line 6
def deliver_with_disk_save!(mail = @mail)
if save_emails_to_disk
FileUtils.mkdir_p(email_output_dir) unless File.directory?(email_output_dir)
filename = "#{Time.now.to_i}_#{mail.to.join(',')}.eml"
File.open(File.join(email_output_dir, filename), "w+") {|f|
f << mail.encoded
}
end
send = case
when !safe_recipients || safe_recipients.empty? then false
when (safe_recipients - [:any, 'any']).length < safe_recipients.length then true
when (mail.to.map(&:downcase) - safe_recipients.map{|r| r.to_s.downcase}).empty? then true
end
return mail unless send
deliver_without_disk_save!(mail)
mail
end
|