I'm thinking of using the HTTPGet() function in the following Ampscript of an email...

var @ItemId,

set @ItemId = '1234'
set @ItemAsset = Concat('http://www.example.com/items/item-',@ItemId,'.png')
set @ItemAssetCall = HTTPGet(v(@ItemAsset),true,1,@ItemAssetCallStatus)

if @ItemAssetCallStatus < 0 then 
  set @ItemAsset = "http://www.example.com/items/item-default.png"

... to see if an image or asset exists on the server (in this case, a png). I am really relying on the CallStatus portion of the function.

I would like to know if there is any downsides to using HTTPGet this way? Is there some scenario I haven't planned for with this set up, in terms of the Ampscript having to wait on the server's response, or the email delaying because it wasn't meant to be used this way, things of that nature.

The reason I'm using this and not something like the Image() Content Ampscript function is I need a bit more control over the image tag.

1 Answer 1


Firstly, you don't need to print (v) a variable if you are using it inside an AMPscript block. You can change:

set @ItemAssetCall = HTTPGet(v(@ItemAsset),true,1,@ItemAssetCallStatus)


set @ItemAssetCall = HTTPGet(@ItemAsset,true,1,@ItemAssetCallStatus)

To answer your question, I've tried requesting different status codes using HTTPGet to httpstat.us and it appears that 2xx and 3xx status codes all return 0 status (which is what you want), while 4xx and 5xx return -2. So, I believe should be fine to rely on the call status!

  • Just wanted to add to this in case anyone else was looking into this solution, that we've been using this to reference external images for a store footer content block with no issues, we send approx. 1.3 million emails a day. Thanks for the help Eliot!
    – Daniel D.
    Commented Jan 30, 2018 at 1:25

You must log in to answer this question.

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