Built-in method send_email to allow attachments to be sent


#1

It would be nice to be able to use the built in method of send_email to allow for attaching a blob or file.

Currently you can use:

$evm.execute(‘send_email’, to, from, subject, body)

to send an email from the notifier appliances. and you can also change the content-type as well, but seems like you cannot send an email with this method. Looking at GenericMailer class it does seem to have some methods to be able to send attachments but I cannot seem to be able to find any documentation or use case that shows how to use that. Maybe someone can shed some light on this.


#2

Adding a plus one to this as I have a use case for this.


#3

Not exactly what you’re looking for, but we did it by using the mail gem directly

require 'mail'

mail = Mail.new do
  from notifyfrom
  to notifyaddr
  subject 'Request From Email: Device Addition, Change, or Decommission'
  body body
  add_file filename: csvfilename,
           content: File.read("#{archivedir}/#{csvfilename}")
end

mail.deliver

#4

Thanks that works perfectly for me.