Error trying to send mail using the API and php CUrl

Error trying to send mail using the API and php CUrl

I'm trying to send emails via API because my server block the outgoing SMTP connectios and I getting this error message

[msg] => Error while processing!
[status] => 500

I follow this steps:


2. I got the AccountId from  http://mail.zoho.com/api/accounts using the token than I get in the step 1

3. Try to send a email using the following code:


  1. $url = "https://mail.zoho.com/api/accounts/$accountId/messages";

  2. $param = [
  3.     "fromAddress"=> "xxxxx@orientha.com.co",
  4.     "toAddress"=> "xxxxxx@gmail.com",
  5.     "subject"=> "Email - Always and Forever",
  6.     "content"=> "Email can never be dead ..."
  7. ];

  8. $ch2 = curl_init();
  9. curl_setopt($ch2, CURLOPT_URL, $url);
  10. curl_setopt($ch2, CURLOPT_FOLLOWLOCATION, 1);
  11. curl_setopt($ch2, CURLOPT_RETURNTRANSFER, 1);
  12. curl_setopt($ch2, CURLOPT_TIMEOUT, 30);
  13. curl_setopt($ch2, CURLOPT_POST, 1);
  14. curl_setopt($ch2, CURLOPT_HTTPHEADER, array('Authorization:'.$AuthToken));
  15. curl_setopt($ch2, CURLOPT_POSTFIELDS, json_encode($param));

  16. $result2 = curl_exec($ch2);
  17. $result2 = json_decode($result2, true);

  18. curl_close($ch);
  19. print_r($result2);