What is the best way to send an inline attachment?

@VictorMonteiro7 using v3 version, not using SDK. followed this post : Sending attachments in API V3 larger than 3MB via multipart
request content type is multipart-formdata And mapped with content-id like this : ```
–form xyzpdqnyla=@/Users/allison/Desktop/nyla.png

@ritulg Can you share an example of your full request? ( change the secrets, IDs and file path )

1 Like
curl --location 'https://api.us.nylas.com/v3/grants/{{grant_id}}/messages/send' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{token}}' \
--data-raw '{
    "subject": "Testing...",
    "body": "<div>testing inline attachment</div><div><br></div><div><img src=\"cid:94614869-e617-49bf-b0c4-476f5c81501a\" width=\"300\"></div><div>Thanks</div>",
    "to": [
        {
            "name": "Ritul",
            "email": "ritulportpro@outlook.com"
        }
    ],
    "attachments": [
        {
            "id": "5f4aa166-8ae1-4077-92d5-4ec94fb9c528",
            "content_type": "img/png",
            "content_disposition": "inline",
            "content_id": "94614869-e617-49bf-b0c4-476f5c81501a",
            "filename": "testing.png",
            "is_inline": true,
            "size": 43717,
            "content": ""
        }
    ]
}'

Issue is facing when sent to outlook email. Working fine when sent to gmail.

@ritulg, there are some errors in your request:

1st: Send only content_id, you don’t need id in the parameters
2nd: Your content_type is wrong. It’s not img/png, it’s image/png
3rd: Your content must be base64
4th: content_disposition is not supported by Microsoft (in my requests, I don’t send it).

Hope this can help you.