I need to attach a PDF file in an Email in Salesforce marketing cloud. i use the function AttachFile() and i use an LINK of that PDF:

var @fileName, @fileAlias
set @fileName = "https://UAT2.cs88.my.salesforce.com/sfc/p/9E0000000XV0/a/9E0000009hqy/C0suCcZI_iTpItmAFsKtkoQ6Kn42Jl1e2SAktZxv8p8.pdf"
set @fileAlias = "Support_V0.2.pdf"
AttachFile('HTTP', @fileName,@fileAlias)

when a send the Email I have the pdf attach but it contain only 2Ko knowing that the real size of the File is 459Ko, and when I try to open the PDF I have an error message "Failed to load the PDF document."

  • Is your pdf file publicly accessible ? – Zak Ben Sep 30 '19 at 8:28
  • Yes and the URL is public – WassiM Sep 30 '19 at 8:28
  • I can't access your URL. Also, I ran your exact same script with a public jpg and it worked fine. Retry with another public pdf url (not linked to your Salesforce account) – Zak Ben Sep 30 '19 at 9:07
  • Okay thank you i'll try with another URL – WassiM Sep 30 '19 at 9:15
  • Hello @ZakBen I try another URL and its work the URL I use first is an URL generated in Service cloud and unfortunately this URL is directly pointed in the fil he point in a page that redirects you to the file I don't know if there is another amp script function that allow me to get the File from this URL ?? – WassiM Oct 3 '19 at 9:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.