I have a requirement where I need to attach a dynamically generated VF PDF to an email generated with an email template. Though I am able to send the template, I am not able to send the attachment. Please suggest how can this be achieved.

  • You mean you have a VF email template with attachment, you build a link to emailAuthor.jsp with the template preselected and it doesn't add the attachment? Or are you sending the email form apex code? Your selection of tags is bit confusing... – eyescream Aug 3 '14 at 17:06
  • 1
    I have used a VF Template. My attachment is also a dynamically rendered PDF but I am not able to attach PDF to the template. And i am sending that email as from apex code. – user2703132 Aug 3 '14 at 17:14
  • Have you seen salesforce.com/us/developer/docs/pages/Content/… ? – eyescream Aug 3 '14 at 17:20

You will need to use the as suggested in comment.

<messaging:attachment renderAs="PDF" filename="yourCases.pdf">

I had a blog post almost years back that you can take help from


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.