title: how to attach generated pdf file mail in java
body: <p>Some body please tell me about how to attach available <code>pdf file</code> to <code>mail</code>.
  I am use <code>mail.jar</code> and <code>activation.jar</code> for sending a <code>mail</code>.
  I can send <code>mail</code> but I dont know how to send <code>pdf file</code> with attachment.
  so please suggest me about that
  thank you.</p>
  
  <p>I just try </p>
  
  <pre><code>           String filename = "file.pdf";
              Multipart multipart1 = new MimeMultipart();
              BodyPart messageBodyPart = new MimeBodyPart();
              DataSource source = new FileDataSource(filename);
              messageBodyPart.setDataHandler(new DataHandler(source));
              messageBodyPart.setFileName(filename);
              multipart1.addBodyPart(messageBodyPart);
  </code></pre>
  
  <p>But still it not get data, it empty attached.</p>