我正在尝试使用 ZohoMail 的 API 通过我的应用程序发送电子邮件。但它不断给我:
"{errorCode":"INVALID_METHOD"},"status":{"code":404,"description":"无效输入"}}
这是我尝试拨打的电话的链接:https : //www.zoho.com/mail/help/api/post-send-an-email.html#Request_Body
这是我的功能:
public static function sendEmail ($AccountId, $AuthCode, $FromAddress, $ToAddress, $Subject, $Content){
$client = new Client(); //GuzzleHttp\Client
$URI = 'http://mail.zoho.com/api/accounts/' . $AccountId . '/messages';
$headers = ['Content-Type' => 'application/json', 'Authorization' => 'Zoho-authtoken ' . $AuthCode];
$body = array('fromAddress' => $FromAddress, 'toAddress' => $ToAddress, 'subject' => $Subject, 'content' => $Content);
$Nbody = json_encode($body);
$response = $client->post($URI, $headers, $Nbody);
echo "DONE!";
}
Run Code Online (Sandbox Code Playgroud)
我试过改变我打电话的方式,但似乎这不是问题所在。我已经在 PostMan 中测试了通话,它工作正常,所以我拨打电话的方式可能有问题。任何帮助将非常感激。