public function createFromArray(array $data)
    {
        $headers = json_encode(
            Arr::path($this->emailConfig, 'defaults.headers', [])
        );

        if (isset($data['sender_localpart'])) {
            if (! Arr::path($this->emailConfig, 'defaults.sender.domain')) {
                throw new \Exception('defaults.sender.domain not set in email config');
            }

            $data['sender_email'] = (
                Arr::remove($data, 'sender_localpart') . '@' .
                Arr::path($this->emailConfig, 'defaults.sender.domain')
            );
        }

        $defaults = [
            'headers'      => $headers,
            'sender_email' => Arr::path($this->emailConfig, 'defaults.sender.email'),
            'sender_name'  => Arr::path($this->emailConfig, 'defaults.sender.name'),
        ];

        $email = $this->emailMapper->getPrototype();

        $email = $email->exchangeArray(
            array_merge($defaults, $data)
        );

        $email = $this->emailMapper->persist($email);

        return $email;
    }