Best Practices

Using inline images increases the overall size of your email, slowing down sending. They also aren’t well supported by web based email clients — such as Gmail, or Yahoo! Mail. We recommend linked images hosted on a server.

Sending with Inline Images

Sendwithus' API takes an array of file objects in the “inline” parameter of the send call. An inline object consists of an “id” and a “data” key.

Note that the file data needs to Base64 encoded. We also recommend that the combined file size does not exceed 7MB.

Sample Request Code

In your API request use the inline parameter to add your Base64 encoded image as the “data” and also give it an “id”, like the file name.

    "template": "tem_9UBhKF8pNFqHwHvPhDjP6F6f",
    "recipient": {
        "name": "John",
        "address": ""
    "inline": {
    	"id": "happy.png",
    	"data": "iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAMAAAC6V+0/AAAANlBMVEX1zHX///////70znj31I799eP20YP53qb879P879V/XjXTrWO5lFSgfUbYsWWOazx0Ui+DYjfNsfnyAAAAfUlEQVQYlXWQ2w6AIAxDK3KTIej//6yboiiZfWjGSZaVYlKE000MHvAhmg6dRZN1N1xmPJqXC7oXY+oEGouPrGEYZaq1e2QYZEipe2DoMcgzHBnwB2W90PWk0tblEG1ZWN6oHTojlT2ta9rLHamFp5yph1e/qReiV6eXPOoAcMkDL0/NWToAAAAASUVORK5CYII="

Sample Image Tag

Then in your template HTML add the image tag using the id you gave your image in the request:

<img src="cid:happy.png" alt="a happy face">

Refer to our Sending API for more information.