I am using the content type “multipart/form-data” when sending emails. How to send inline attachments in such case?
Please let me know if you need more information to have a better insight.
I believe the info in the “Sending Inline attachments using form data” section of this help article will help you:
Here’s the mentioned cURL snippet from that page:
curl --request POST \
--url https://api.us.nylas.com/v3/grants/{{grant_id}}/messages/send \
--header 'Authorization: Bearer {{NYLAS_API_KEY}}' \
--header 'Content-Type: multipart/form-data' \
--form 'message={
"body": "Hey there! This is an email testing out inline attachments using the Nylas Email API. Here is what their mascot looks like -- I think she is so cute! <br> <img src=\"cid:xyzpdqnyla\"/> <br> They also have a cool logo: <img src=\"cid:xyzpdqlogo\"/>.",
"subject": "Testing out inline attachments",
"to": [{
"email": "test@outlook.com",
"name": "Adrian Traeger"
}]
}' \
--form xyzpdqnyla=@/Users/TestPath/Desktop/nyla.png \
--form xyzpdqlogo=@/Users/TestPath/Desktop/logo.png
Basically, you need to embed a cid reference in the message body, and then pass your file as the form data for the same alphanumeric string as the cid.
Does that solve your problem, or are you having trouble further down the line with a specific language or scenario?