0

I'm trying to attach a file with AttachFile AMPScript but looks like I'm missing something.

here is my code:

%%[
  set @billingUrl = RequestParameter("billingUrl")
]%%

<!-- it works, but I need the request params value --> 
%%= AttachFile('HTTP', 'http://example.com/static-url.pdf') =%%

<!-- it doesn't work and do not send emails -->
%%= AttachFile('HTTP', v(@billingUrl), 'fatura.pdf') =%%
or 
%%= AttachFile('HTTP', @billingUrl, 'fatura.pdf') =%%
or 
%%= AttachFile('HTTP', {{billingUrl}}, 'fatura.pdf') =%%


<!-- it works -->
url: %%=v(@billingUrl)=%%  

<!-- it works -->
url: {{billingUrl}}

What am I missing here?

4
  • do you have attachments enabled on your account?
    – 0xsegfault
    Commented Apr 2, 2018 at 23:26
  • @Data_Kid yes man! It's available. I've updated the example showing what works. Commented Apr 3, 2018 at 13:42
  • How are you passing the billing url to the page? %%= AttachFile('HTTP', v(@billingUrl), 'fatura.pdf') =%% wont work as that how you call the value of a variable from outside the block not within it
    – 0xsegfault
    Commented Apr 3, 2018 at 14:29
  • Try putting the variable in quotes e. g %%= AttachFile('HTTP', '@billingUrl', 'fatura.pdf') =%%
    – 0xsegfault
    Commented Apr 3, 2018 at 14:38

2 Answers 2

1

For those who are looking for the answer, I've found this way to make it works.

%%
  [
    Var @billingUrl
    Set @billingUrl = TreatAsContent('{{billingUrl}}')
  ]
%%

%%=AttachFile('HTTP', @billingUrl)=%%

Looks like RequestParameter("billingUrl") didn't work as expected

0

You might want to enable the AttachFile ampscript via account manager. This is a paid feature and is charged per 1000 attachments.

Please refer to this link

Thanks

Chandan

1
  • It's available. I've updated the example showing what works. Commented Apr 3, 2018 at 13:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .