fixed orbit mailer for no file title

This commit is contained in:
spen 2014-10-13 15:25:30 +08:00
parent b33c2d5b38
commit d4df227811
1 changed files with 10 additions and 3 deletions

View File

@ -29,9 +29,16 @@ class OrbitMailer < ActionMailer::Base
unless email.email_files.blank?
email.email_files.each_with_index do |email_file, i|
unless email_file.file.blank?
if !email_file.title.blank?
file_type = File.extname(email_file.file.to_s)
# file_content = File.read(email_file.file.url)
attachments["#{email_file.title}#{file_type}"] = email_file.file.read
else
file_name = File.basename(email_file.file.path)
attachments["#{file_name}"] = email_file.file.read
end
end
end
end