当我尝试向特定联系人发送邮件时,一切正常。
但是当我尝试使用basic authentication
通过Mautic api将邮件发送到网段时,会发生错误。
$api = new MauticApi();
$initAuth = new ApiAuth();
$settings = array(
'userName' => 'admin',
'password' => 'xxxxxxxxxxxx'
);
$auth = $initAuth->newAuth($settings, 'BasicAuth');
$apiUrl = "https://<domain-name>/mautic/api";
$emailId = <email-id>; // $emailId is 7 in my case.
$emailApi = $api->newApi("emails", $auth, $apiUrl);
$email = $emailApi->send($emailId);
var_dump($email);
出现如下所述的错误。
错误-
array(2){
[
"errors"
]=>array(1){
[
0
]=>array(2){
[
"code"
]=>int(404)[
"message"
]=>string(403)"The response has unexpected status code (404). Response: { "errors": [ { "code": 404, "message": "Itemwasnotfound.", "details": [] } ], "error": { "message": "Itemwasnotfound.(`error`isdeprecatedasof2.6.0andwillberemovedin3.0.Usethe`errors`arrayinstead.)", "code": 404, "details": [] } }"
}
}[
"error"
]=>array(2){
[
"code"
]=>int(404)[
"message"
]=>string(403)"The response has unexpected status code (404). Response: { "errors": [ { "code": 404, "message": "Itemwasnotfound.", "details": [] } ], "error": { "message": "Itemwasnotfound.(`error`isdeprecatedasof2.6.0andwillberemovedin3.0.Usethe`errors`arrayinstead.)", "code": 404, "details": [] } }"
}
}