Announcement

Collapse
No announcement yet.

Cannot use Folder ID filter when reading emails from API

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Cannot use Folder ID filter when reading emails from API

    Hi All, need your help please.
    I am working on a script that will automatically do some stuffs when an email address does not exist and I receive this bounce notification 'Undelivered Mail Returned to Sender'
    I have a filter in EspoCRM that will automatically move these emails to the folder "Undelivered" as you can see in the email and it works perfectly.

    When I try to read the emails from the API it works great with this code.
    PHP Code:
    $where = ["dateTime" => true'type' => "after""attribute" => "dateSent""value" => '2020-06-18'"timeZone" => "UTC"];
    $where2 = ['type' => "equals""attribute" => "name""value" => 'Undelivered Mail Returned to Sender'];
    $result $client->request('GET''Email', ['order' => 'desc'"orderBy" => "createdAt""offset" => 0"maxSize" => 200"where" => [$where2$where]]);
    echo 
    "<pre>"var_dump($result); echo "</pre>";exit; 
    Now When I try to only load email from "Undelivered" folder as shown by the following line, it returns an empty result
    Code:
    $result = $client->request('GET', 'Email', [[I][U][B]'folderId' => '5f3b77cde265a6a0b',[/B][/U][/I] 'order' => 'desc', "orderBy" => "createdAt", "offset" => 0, "maxSize" => 200, "where" => [$where2, $where]]);
    echo "<pre>"; var_dump($result); echo "</pre>";exit;
    It look like this issue is more related to the API User because when I copy the URL generated by the EspoApiClient and paste that into a tab of a browser where am logged into the the CRM, I have all my data as expected

    Any suggestion? all email related permissions are set for this user
Working...
X