How to Send an Email with Attachment using Zoho Mail API

Have you ever tried to send an email with an attachment using the Zoho Mail API and received a 400 error? You're not alone. This is a common issue that many users face when trying to send attachments via Zoho Mail. But don't worry, there's a solution.

Step-by-Step Solution

Here's a step-by-step guide on how to send an email with an attachment using the Zoho Mail API:

  1. Use the HTTP Module to get the file.
  2. Use the Zoho API Call module to get the ID account (/account call).
  3. Use the Zoho API Call module to upload the attachment (/messages/attachments call) with the following headers:
    • Key: Content-Type
    • Value: application/octet-stream
    And the following query parameters:
    • Key: fileName
    • Value: [5. file name] (from the HTTP module)
    And the following body:
    • [5. data] (from the HTTP module)
  4. Use the Zoho API Call module to send the mail (/messages call) with the following header:
    • Key: Content-Type
    • Value: application/json
    And the following body:
    { "fromAddress": "from@email.com", "toAddress": "dest@email.com", "subject": "test api attach", "content": "body content", "attachments": [ { "storeName" : "{{7.body.data.storeName}}", "attachmentPath" : "{{7.body.data.attachmentPath}}", "attachmentName" : "{{7.body.data.attachmentName}}" } ] }

Troubleshooting Tips

If you're still having trouble, make sure you're using the correct headers and query parameters. Also, check that you're using the correct body content. If you're still having issues, try different Zoho connection rights parameters (read, create, etc).

Conclusion

Sending an email with an attachment using the Zoho Mail API can be tricky, but with the right steps, it's definitely doable. Remember to use the correct headers, query parameters, and body content. And don't forget to check your Zoho connection rights parameters if you're still having trouble. Happy emailing!

You do have further questions?

Ask your question via E-Mail: Richard@make-app.de
Book a paid Support & Consulting Session
New Make.com user? Sign up through this Affiliate Link to receive 10.000 operations for FREE.