/** * Sends email. * @param Message $mail * @return void */ public function send(Message $mail) { $postData = ['from' => $mail->getHeader('Return-Path') ?: key($mail->getHeader('From')), 'to' => $this->getCommaSeparatedEmails((array) $mail->getHeader('To')), 'cc' => $this->getCommaSeparatedEmails((array) $mail->getHeader('Cc')), 'bcc' => $this->getCommaSeparatedEmails((array) $mail->getHeader('Bcc')), 'subject' => $mail->getSubject(), 'text' => $mail->getBody(), 'html' => $mail->getHtmlBody()]; $this->mailgun->sendMessage($this->domain, array_filter($postData)); }