protected function prepareCallback()
    {
        return function ($mail) {
            $mail->subject($this->subject);

            $mail->from(
                array_get($this->from, 'address', $this->config->get('mail.from.address')),
                array_get($this->from, 'name', $this->config->get('mail.from.name'))
            );

            foreach ($this->recipients as $type => $recipients) {
                foreach ($recipients as $recipient) {
                    $mail->{$type}($recipient['email'], $recipient['name']);
                }
            }

            foreach ($this->attachments as $attachment) {
                $options = [];

                if (is_array($attachment)) {
                    list($attachment, $options) = $attachment;
                }

                $mail->attach($attachment, $options);
            }

            foreach ($this->dataAttachments as $name => $data) {
                $options = [];

                if (is_array($data)) {
                    list($data, $options) = $data;
                }

                $mail->attachData($data, $name, $options);
            }
        };
    }