src/Viserio/Component/Mail/Mailer.php
public function send($view, array $data = [], $callback = null): int
    {
        // First we need to parse the view, which could either be a string or an array
        // containing both an HTML and plain text versions of the view which should
        // be used when sending an e-mail. We will extract both of them out here.
        [$view, $plain, $raw] = $this->parseView($view);

        $data['message'] = $message = $this->createMessage();

        // Once we have retrieved the view content for the e-mail we will set the body
        // of this message using the HTML type, which will provide a simple wrapper
        // to creating view based emails that are able to receive arrays of data.
        $this->addContent($message, $view, $plain, $raw, $data);

        if ($callback !== null) {
            $this->callMessageBuilder($callback, $message);
        }

        // If a global to address has been specified we will override
        // any recipient addresses previously set and use this one instead.
        if (isset($this->to['address'])) {
            $message->to($this->to['address'], $this->to['name'], true);
            $message->cc(null, null, true);
            $message->bcc(null, null, true);
        }

        $recipients = $this->sendSwiftMessage($message->getSwiftMessage());

        if ($this->eventManager !== null) {
            $this->eventManager->trigger(new MessageSentEvent($this, $message->getSwiftMessage(), $recipients));
        }

        return $recipients;
    }
public function send($view, array $data = [], $callback = null): int
    {
        // First we need to parse the view, which could either be a string or an array
        // containing both an HTML and plain text versions of the view which should
        // be used when sending an e-mail. We will extract both of them out here.
        [$view, $plain, $raw] = $this->parseView($view);

        $data['message'] = $message = $this->createMessage();

        // Once we have retrieved the view content for the e-mail we will set the body
        // of this message using the HTML type, which will provide a simple wrapper
        // to creating view based emails that are able to receive arrays of data.
        $this->addContent($message, $view, $plain, $raw, $data);

        if ($callback !== null) {
            $this->callMessageBuilder($callback, $message);
        }

        // If a global to address has been specified we will override
        // any recipient addresses previously set and use this one instead.
        if (isset($this->to['address'])) {
            $message->to($this->to['address'], $this->to['name'], true);
            $message->cc(null, null, true);
            $message->bcc(null, null, true);
        }

        $recipients = $this->sendSwiftMessage($message->getSwiftMessage());

        if ($this->eventManager !== null) {
            $this->eventManager->trigger(new MessageSentEvent($this, $message->getSwiftMessage(), $recipients));
        }

        return $recipients;
    }
{@inheritdoc}