I am trying to make a form that will send an email with an application using Action Mailer. I do not use the model to return the object that I am loading. I would like to attach the file directly to the message without saving it to the serverβs hard drive. In my controller:
def create attachment = params[:attachment].read ApplicationRequestMailer.send_application_to_be_entered(current_user.member, attachment).deliver render :nothing => true end
In my mail program:
class ApplicationRequestMailer < ActionMailer::Base def send_application_to_be_entered(member, file) attachment[file.origional_name] = file.read mail(:to => ' test@test.com ', :subject => "To Be Entered") end end
Is there any way to do this? or do I need to save the file first using something like paperclip?
source share