4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'app/mailers/printer_mailer.rb', line 4
def send_print usr, file, msg=nil, subj=nil
@usr = usr
fname = case file
when /\/pdf.*$/; 'print%s.pdf' % DateTime.now.nsec
else 'print%s.label' % DateTime.now.nsec
end
attachments[fname] = File.read(file) unless file.blank?
@logo = @usr.account.logos.first.image.url rescue ""
attachments.inline['logo.png'] = File.read( File.join(Rails.root,'public',@logo)) unless @logo.blank?
@msg = msg || "See attached PDF"
subj ||= "Kontakt administrator! Der mangler en printer definition!"
mail from: '[email protected]',
to: @usr.email,
subject: subj
end
|