function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
goodankit@yahoo.comgoodankit@yahoo.com 

How can we send visualforce email template with attachment in email and in DOC type extension.

Patcs_1Patcs_1
Hi

If you want to attach the static attachment, then you can use the "Standard Attchment" section in the email template.


If you want to use the dynamic attachment, then you can use the below code.
<messaging:emailTemplate subject="test" recipientType="Contact" >
<messaging:htmlEmailBody >
<html>
    <body>
       Test data
     </body>
</html>
</messaging:htmlEmailBody>
<messaging:attachment renderAs="application/msWord" filename="Testfilename"> 
<html>
    <body>
       Test data
     </body>
</html>
</messaging:attachment>
</messaging:emailTemplate>

Hope it helps!

Thanks

If this solves your problem, Please mark this as solution by selecting it as best answer