I have a single attachment created using Visualforce to send out via email. I am using a Visualforce email template and specifying the setTemplateId attribute in my Apex class and then using the SingleEmailMessage class.
Alternatively, I could create a Visualforce page, create the attachment and then use the EmailFileAttachment class on that attachment and associate that object with the SingleEmailMessage class.
Is one approach better than the other? It seems the former is 'cleaner' but if one also has a requirement to have a record of the email attachment in Salesforce, then the latter is preferable. Curious if there is any recommended approach to use of the two?