title: How to send mail with (docx,pdf) attachments using actionmailer
body: <p>i need to get uploaded docx or pdf file in my mail inbox.so that i did the following code.</p>
  
  <p>here is my controller,</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>def create
      @apply = Apply.new(apply_params)
        if @apply.save
          attachment=@apply.avatar.path(:thumb)
          logger.info attachment.inspect
          CareerMailer.send_career_email(@user, attachment).deliver
        end
  end</code></pre>
  </div>
  </div>
  </p>
  
  <p>my careermailer.rb</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>class CareerMailer &lt; ApplicationMailer
  default :from =&gt; 'support@gmail.com'
  
    def send_career_email(user,attachment)
      @user = user
      email='me@gmail.com'
      attachments["file-name.docx"] = File.read("#{attachment}",mode: "rb") {|io| a = a + io.read} 
      mail( :to =&gt; email,
            :subject =&gt; 'You have been signed up' )
    end
  end</code></pre>
  </div>
  </div>
  </p>
  
  <p>when i tried this i'm not getting the uploaded attachments in my mail. what is wrong in my code.</p>
  
  <p>Please give me a solution</p>