0

I have a custom object 'Invoice' that has a lookup relationship with Contact. The invoice object stores pdf files in 'Notes & Attachments'. I want to send the URL of the files in a visualforce email template.

Below is my code:

<messaging:emailTemplate subject="Unpaid Invoice" recipientType="Contact" relatedToType="Invoice__c">
<messaging:htmlEmailBody >

<html>
    <head></head>
    <body>
        <p>Dear {!recipient.name}</p>
        
        <p>This is the first email reminder about your unpaid invoice.</p>
        <p>Click on the link below to view the invoice.</p>
    </body>
</html>

</messaging:htmlEmailBody>

        <apex:repeat value="{!relatedTo.Attachments}" var="a">
        <a href="{!URLFOR($Action.Attachment.Download, a)}">Click Here</a> 
        </apex:repeat>

</messaging:emailTemplate>

For some reason, I don't see any link in the email. I don't know what I am doing wrong.

0