I'm trying to send an email attachment using action mailer in ruby on rails and I keep getting this error. The problem seems to be that it can't locate the file in the directory I specified, but the file path is valid. I also checked this using File.exist?
in the console and confirmed that the path provided evaluates to true.
Here is my mailer:
class OrderMailer < ApplicationMailer
def purchase(order)
@order = order
attachments[ 'files.zip'] = File.read(Rails.root + '/public/albums/files.zip')
mail to: order.email, subject: "Order Confirmation"
end
end
I also installed the mail gem to handle encoding, as advised by the Action Mailer documentation.
Any help would be much appreciated, -Brian