public function send(CakeEmail $email) {
        if (Configure::read('Mailgun.preventManyToRecipients') !== false && count($email->to()) > 1) {
            throw new Exception('More than one "to" recipient not allowed (set Mailgun.preventManyToRecipients = false to disable check)');
        }

        $mgClient = new Mailgun($this->_config['mg_api_key']);

        $headersList = array('from', 'sender', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'bcc', 'subject');
        $params = [];
        foreach ($email->getHeaders($headersList) as $header => $value) {
            if (isset($this->_paramMapping[$header]) && !empty($value)) {
                $key = $this->_paramMapping[$header];
                $params[$key] = $value;
            }
        }

        $params['text'] = $email->message(CakeEmail::MESSAGE_TEXT);
        $params['html'] = $email->message(CakeEmail::MESSAGE_HTML);

        $attachments = array();
        foreach ($email->attachments() as $name => $info) {
            $attachments['attachment'][] = '@' . $info['file'];
        }

        try {
            $result = $mgClient->sendMessage($this->_config['mg_domain'], $params, $attachments);
            if ($result->http_response_code != 200) {
                throw new Exception($result->http_response_body->message);
            }
        } catch (Exception $e) {
            throw $e;
        }

        return $result;
    }