/** * Send invoice through mail (via BB API). * * @param $contactPersonId * @param $emailSubject * @param $emailBody * @return object result information (only if successful) * @throws BbException if the invoice has not been saved */ public function mail($contactPersonId, $emailSubject, $emailBody) { if (!$this->id) { throw new BbException('The invoice cannot be mailed, because it has not been saved.'); } $data = array('email' => array('contactPersonId' => $contactPersonId, 'emailSubject' => $emailSubject, 'emailBody' => $emailBody)); return parent::request('POST', 'v2/invoices/' . $this->id . '/emails', $this->accessToken, (object) $data); }