lanlin/nylas-php

Cannot add someone in copy via the SDK

MilesYM opened this issue · 0 comments

Hello

I am following the documentation to add someone in cc with the SDK 4.2.5 however I receive an error message saying this method does not exist:

`public function sendEmail($to, $name, $message, $subject, User $user)
{
if (!$to)
return false;
$this->nylas->Options()->setAccessToken($user->getOAuthToken());
$this->nylas->Options()->setAccountId($user->getNylasAccountId());

    $params = [
        'to' => [
            [
              'email' => $to,
              'name' => $name,
            ],
        ],
        'tracking' => [
            'links' => false,
            'opens' => true,
            'thread_replies' => $user->getMailboxWhitelisted() ? true : false,
        ],
        'body' => $message,
        'subject' => $subject,
    ];

    if ($user->getBrokerUser() && $user->getBrokerUser()->getId() === 14824) {
        $params['cc'] =
            [
                "name" => "First Name Last Name",
                "email" => "myemail@gmail.com"
            ];
    }

    return $this->nylas->Messages()->Sending()->sendDirectly($params);
}`

Whenever I add the 'cc' parameter, it returns an error message and nothing is sending.

Is there an issue with the cc paramter or am I doing something wrong?

Many thanks