Confusion on how to add attachments to transactional emails
I'm currently trying to attach a pdf to a transactional email. Looking at the docs, it says that it takes a Base64 encoded chunk data of the attachment generated on the fly, but the actual type is a Blob. I've actually tried both a Blob and a base64 string, but while the email does send, it doesn't have the attachments.
What's the correct way to add an attachment?
This is an old question, but perhaps it will help others.
...
attachments = [
{
content: "here is the base64",
name: "some filename"
}
]
...
I had a similar issue.
I was following the docs here
In my understanding, I should send an array of SendSmtpEmailAttachment objects, but it does not work when done this way.
The only way it worked was passing the hash as @sergomet suggested directly to the mail.attachment array. It worked this way.