[SalesForce] Dynamically send Attachment from Marketing Cloud

I'm wondering if it's possible to dynamically send an attachment with an email from marketing cloud.

In the marketing cloud, we will have contact details, based on certain criteria I want to pick a pdf file by matching the pdf name with some contact parameter, and if the pdf file matches, I want to send it as an attachment to that contact.

Also is it possible to keep all my attachments in the Marketing cloud or I need to keep in outside marketing cloud?

Best Answer

The answer to all your questions is yes:

  • you can store pdfs or other files either in Content Builder or in your sFTP
  • you can use AMPscript to attach the files to your emails
  • you can use AMPscript to dynamically match subscriber data with files and to create conditional statements
  • you can match a file based on a filename, customer key, etc.

Some examples can be found in the ampscript.guide: https://ampscript.guide/attachfile/

Here is one of the examples from ampscript.guide:

This example attaches a Content Builder asset by Customer/External Key:

%%[

var @customerKey, @fileAlias
set @customerKey = "LoyaltyMembersCB"
set @fileAlias = "LoyaltyMembers_ContentBuilder.zip"

AttachFile("ContentBuilder", @customerKey, @fileAlias)

]%%

Make sure to contact SF support to enable attachments in your account first.

Related Topic