So I'm writing an HTML email with attachments. The thing is I'm trying to find out if I can set up dynamic attachments based on the content of a Data Extension.
My Data Extension looks like this:
Attachment Customer Key | Attachment Name | EmailAddress | Username |
---|---|---|---|
myContactKey12345 | Document1 | [email protected] | Jason |
myContactKey09887 | Document2 | [email protected] | Craig |
I have two Documents in Content Builder and I've modified the Customer Key for each of those attachments to match the values in the table above. So, for example, Document1 customer key is myContactKey12345
in Marketing Cloud.
I want to send emails such that attachments are unique to the email address I'm sending to.
So, for example, I want to send Sample Email 1
to [email protected]
but I only want Jason to receive Document1. I want to send the same Sample Email 1
to [email protected]
but I only want Craig to receive Document 2.
This is the ampscript I've tried using and while it doesn't give me any errors during preview and test, when I send a test email I don't ever receive that test email.
Can I even do something like this? Is doing it with ampscript not the solution I'm looking for?
%%[
SET @attachmentkey = attachmentKeyFromDE
AttachFile('ContentBuilder', "%%=v(@attachmentkey)=%%", "document.pdf")
]%%