Hi,
I am unable to send / view attachments using zoho mail API.
These are the postman calls I made to upload an attachment and send mail
UPLOAD
Request
headers: {"Authorization": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}
Response
{
"status": {
"code": 200,
"description": "success"
},
"data": {
"storeName": "xxxxxxxxx",
"attachmentName": "C:/node/latestioc/ioc/ioc-backend/simdata.xlsx",
"attachmentPath": "/Mail/xxxxxxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxx-simdata.xlsx"
}
}
SEND MAIL
Request
headers: {"Authorization": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "Content-Type": "application/json"}
body:
{
"subject": "Hello",
"content": "Email can never be dead. The most neutral and effective way, that can be used for one to many and two way communication.",
"attachments": [{"storeName": "xxxxxxxxx",
"attachmentPath": "/Mail/xxxxxxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxx-simdata.xlsx",
"attachmentName": "xxxxxxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxx-simdata.xlsx"
}]
}
Response
{
"status": {
"code": 200,
"description": "success"
},
"data": {
"attachments": [
{
"attachmentName": "xxxxxxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxx-simdata.xlsx",
"storeName": "xxxxxxxxx",
"attachmentPath": "/Mail/xxxxxxxxxxxxxxxxxxxxxxxxxx_xxxxxxxxxx-simdata.xlsx"
}
],
"subject": "Hello",
"content": "Email can never be dead. The most neutral and effective way, that can be used for one to many and two way communication."
}
}
I got the mail in gmail. When I tried to open the attachment in google sheets it shows error: "
Unable to convert document.". I tried to open it in excel app, it says: "File format or file extension is not valid. verify that the file has not been corrupted and that the file extension matches the format of the file.".
For upload header, I tried content-Type as application/x-www-form-urlencoded, application/json, application/octet-stream. Using x-www-form-urlencoded & json, I couldn't even send the email. Using octet-stream, I could send the email but the above problem prevails.
When I send the mail to zoho mail. I cannot even see the attachment. Someone please tell me what I'm doing wrong!