Is there a way to add attachment links in the email body via the Email REST api

Options

We are currently sending attachments via the REST api with the pullfile_options enabled and it adds the attachment links at the bottom of the email. Is there any way for us to control where the attachment hyperlinks appear in the email? Is there a way to use inserts so we could control where they are placed in the email body?

Thanks!

Best Answer

  • Akash Venugopal
    Options

    You can use the pull file name inside the html body.

    <p><a href="[pull name="test.pdf"]" style="color: black;" target="_blank" title="pull file">Click here</a> to download the file</p>


    The name provided in the pull name should match the attachment name.

Answers

  • Akash Venugopal
    Options

    You can use the pull file name inside the html body.

    <p><a href="[pull name="test.pdf"]" style="color: black;" target="_blank" title="pull file">Click here</a> to download the file</p>


    The name provided in the pull name should match the attachment name.

  • @Akash Venugopal is there anyway to stop it from adding the “Documents” section at the bottom of the email?

  • The file name if included in the body, ideally it will not be listed separately.

    A sample html body and pull file is as below.

    {    "destinations": [        {            "ref": "1",            "email": "test@test.com"        }    ],    "body": [        {            "name": "temp.html",            "type": "html",            "data": "PCFET0NUWVBFIEhUTUwgUFVCTElDICItLy9XM0MvL0RURCBIVE1MIDQuMCBUcmFuc2l0aW9uYWwvL0VOIj4KPGh0bWw+CjxoZWFkPjxtZXRhIGh0dHAtZXF1aXY9IkNvbnRlbnQtVHlwZSIgY29udGVudD0idGV4dC9odG1sOyBjaGFyc2V0PXV0Zi04Ii8+PC9oZWFkPgo8Ym9keSBzdHlsZT1mb250LWZhbWlseTpBcmlhbD4KPGgxPlRlc3QgZW1haWwgd2l0aCBwdWxsIGZpbGU8L2gxPgoKPHA+VGhpcyBpcyB0aGUgZW1haWwgYm9keS48L3A+Cgo8cD5UaGlzIGlzIHRoZSBwdWxsIGZpbGUgPGEgaHJlZj0iW3B1bGwgbmFtZT0iZmlsZW5hbWUucGRmIl0iIHN0eWxlPSJjb2xvcjogYmxhY2s7IiB0YXJnZXQ9Il9ibGFuayIgdGl0bGU9InB1bGwgZmlsZSI+Y2xpY2sgaGVyZSB0byBhY2Nlc3MgdGhlIGZpbGU8L2E+PGJyIC8+CiZuYnNwOzwvcD4KCjwvYm9keT4KPC9odG1sPgo="        }    ],    "attachments": [        {            "name": "filename.pdf",            "type": "pdf",            "pullfile_options": {                "enabled": true,                "autopull": false            },            "data": ""        }    ]}