APIEmailService with attachments?


We want to use APIEmailService to send invoices we’ve generated using external software. (Since sending the internally-generated ones using the UI takes us ridiculous amounts of time - see Manually send a collection of invoices?).

Does the APIEmailService support attachments? There seems to be a multipart feature, but it looks from the documentation as though that’s intended to mean ‘both HTML and text’.

  • Charles

Hi @Charles_Weir, the APIEmailService doesn’t support traditional attachments. However, if you were to upload a file to your FileBox, you could then insert it into your email’s HTML/text as a merge field using this format ~HostedAttachment_$FILEBOXID~ (replacing $FILEBOXID with the appropriate id) and send the email using this API method.

Nice! Thank you, @Nicholas_Trecina.

Quick add here: this HostedAttachment merge field will generate an HTML tag with a public link to that file that will work even if the file is not public (i.e. all files uploaded via API). The tag content is going to be the file name.

I should also mention the PHP SDK is returning false, even when the email is arriving on my inbox :man_shrugging:t2:
But it took me a while to dig on Google and discover they were not arriving because my email wasn’t allowed to receive messages at the first place.