Creates a new message, which can be send with a mailer

@return Swift_Message
345602
public function createMessage() {
		$prefs = $this->getPreferenceLoader()->getSystemPreferences();

		$message = new Swift_Message();
		$sender = $prefs->getPlattformEmail();
		if (!empty($sender)) {
			$message->setFrom($prefs->getPlattformEmail(), $prefs->getPlattformName());
		}

		return $message;
	}
1068019
protected function createMessage($body)
    {
        return $this->mailer->compose('nfy/message', ['message' => $body])
            ->setSubject(Yii::t('app', 'Notification from {app}', ['app' => Yii::$app->name]));
    }
732758
public static function create()
    {
        $email = new static();
        $email->from(Yii::$app->params['mandrill']['from_name'], Yii::$app->params['mandrill']['from_email']);
        return $email;
    }
616004
protected function createMessage()
	{
		$message = new Message( new Swift_Message );

		// If a global from address has been specified we will set it on every message
		// instances so the developer does not have to repeat themselves every time
		// they create a new message. We will just go ahead and push the address.
		if ( !empty( $this->from['address'] ) )
		{
			$message->from( $this->from['address'], $this->from['name'] );
		}

		return $message;
	}
851603
public function done($mail)
    {
        $transport = $this->getTransport();
        $mailer = new \Swift_Mailer($transport);

        Events::dispatch('onEmail', array(
            'emails' => $mail->getTo(),
            'subject' => $mail->getSubject(),
            'message' => $mail->getBody(),
            'transport' => $transport
        ));
        $result = $mailer->send($mail, $fail);
        return $result;
    }
555520
private function _mail($to, $subject, $message)
		{
			// Set up swift mailer if needed
			if (!$this->_mailer) {
				$transport = NULL;
				// Set transport to php
				if (strtolower($this->transportType) == 'php') {
					$transport = Swift_MailTransport::newInstance();
				} // Set transport to smtp
				elseif (strtolower($this->transportType) == 'smtp') {
					$transport = \Swift_SmtpTransport::newInstance();

					foreach ($this->transportOptions as $option => $value) {
						$methodName = 'set' . ucfirst($option);
						$transport->$methodName($value);
					}
				}

				// Create Mailer object
				$this->_mailer = \Swift_Mailer::newInstance($transport);
			}

			// Set up message
			$mailer  = $this->_mailer;
			$message = Swift_Message::newInstance($subject)->setFrom('not@used.com')->setTo($to)->setBody($message);

			return $mailer->send($message);
		}
1127394
protected function createSmtpDriver()
    {
        $config = $this->app['config']['mail'];

        // The Swift SMTP transport instance will allow us to use any SMTP backend
        // for delivering mail such as Sendgrid, Amazon SES, or a custom server
        // a developer has available. We will just pass this configured host.
        $transport = SmtpTransport::newInstance(
            $config['host'], $config['port']
        );

        if (isset($config['encryption'])) {
            $transport->setEncryption($config['encryption']);
        }

        // Once we have the transport we will check for the presence of a username
        // and password. If we have it we will set the credentials on the Swift
        // transporter instance so that we'll properly authenticate delivery.
        if (isset($config['username'])) {
            $transport->setUsername($config['username']);

            $transport->setPassword($config['password']);
        }

        return $transport;
    }
1316668
public function make(): \BearFramework\Emails\Email
    {
        if (self::$newEmailCache === null) {
            self::$newEmailCache = new \BearFramework\Emails\Email();
        }
        return clone(self::$newEmailCache);
    }
1297687
public function create()
    {
        /**
         * @var NewsletterSubscription $newsletterSubscription
         */
        $classNamespace = $this->getEntityNamespace();
        $newsletterSubscription = new $classNamespace();
        $newsletterSubscription
            ->setEnabled(true)
            ->setCreatedAt($this->now());

        return $newsletterSubscription;
    }
270417
protected function wrapMimeMessage(Swift_Message $message)
    {
        // Start by copying the original message into a message stream
        $messageStream = new Swift_ByteStream_TemporaryFileByteStream();
        $message->toByteStream($messageStream);
        $messageStream->commit();

        // Create a new MIME part that wraps the original stream
        $wrappedMessage = new Swift_MimePart($messageStream, 'message/rfc822');
        $wrappedMessage->setEncoder(new Swift_Mime_ContentEncoder_PlainContentEncoder('7bit'));

        return $wrappedMessage;
    }
345175
public function build($to, $subject, $message)
    {
        $mail = new \Swift_Message($subject, $message, 'text/html', 'UTF-8');
        $mail->setFrom($this->from, $this->fromName);
        $mail->setTo($to);
        return $mail;
    }
1177915
public function getMailer() {
		if ($this->mailer === null) {
			$prefs = $this->getPreferenceLoader()->getSystemPreferences();
			switch ($prefs->getMailTransport()) {
				case SystemPreferences::MAIL_TRANSPORT_SMTP:
					$transport = new Swift_SmtpTransport($prefs->getSmtpServer(), $prefs->getSmtpPort());
					$transport->setUsername($prefs->getSmtpUsername());
					$transport->setPassword($prefs->getSmtpPassword());
					$encryption = $prefs->getSmtpEncryption();
					if ($encryption != SystemPreferences::SMTP_ENCRYPTION_NONE) {
						$transport->setEncryption($encryption);
					}
					break;

				case SystemPreferences::MAIL_TRANSPORT_SENDMAIL:
					$transport = new Swift_SendmailTransport($prefs->getSendmail());
					break;

				case SystemPreferences::MAIL_TRANSPORT_MAIL:
				default:
					$transport = new Swift_MailTransport();
					break;
			}

			$this->mailer = new Swift_Mailer($transport);
		}

		return $this->mailer;
	}
171116
public function toMessage()
    {
        $msg = new Message(array(
                $this->requestId,
                $this->action,
            ));

        $msg->append($this->params);

        return $msg;
    }
38173
public function sendActivationMessage()
    {
        $macros  = new Macros($this->_data);
        $message = $this->_params->get('msg_account_activate_msg');
        $message = $macros->text($message);
        $subject = $this->_params->get('msg_account_activate_subject');

        return $this->send($subject, $message, $this->_data->email, null, $this->_getFromMail());
    }
526386
public function getMessage()
    {

        if (!is_a($this->container, 'PhpBotFramework\Entities\Message')) {
            $this->container['message'] = new Message($this->container['message']);
        }

        return $this->container['message'];
    }
726297
public function createMessage($recipient, $subject, $body)
    {
        $recipients = explode(',', trim($recipient));

        return \Swift_Message::newInstance()
            ->setSender($this->sender)
            ->setFrom($this->sender)
            ->setTo($recipients)
            ->setSubject($subject)
            ->setBody($body, 'text/html');
    }
976429
private function getMailer(): \Swift_Mailer
    {
        // If the mailer has already been defined via the constructor, return it.
        if ($this->mailer) {
            return $this->mailer;
        }

        // Get the proper transporter
        switch ($this->config('mailer.transport')) {
            case 'smtp':
                $transport = $this->getSmtpTransport();

                break;

            case 'mail':
                throw new MailerException(
                    "'mail' transport is no longer supported, please use 'smtp' or 'sendmail' transport."
                );

                break;

            default:
                $transport = $this->getSendMailTransport();
        }

        $this->mailer = new \Swift_Mailer($transport);

        return $this->mailer;
    }