public function mail() {
		// if the instance has not been created yet
		if (!isset($this->mail)) {
			// create the instance

			$transport = null;

			if (isset($_ENV['MAIL_TRANSPORT'])) {
				if ($_ENV['MAIL_TRANSPORT'] === 'smtp') {
					$transport = \Swift_SmtpTransport::newInstance();
					$transport->setHost($_ENV['MAIL_HOST']);
					$transport->setPort($_ENV['MAIL_PORT']);
					$transport->setUsername($_ENV['MAIL_USERNAME']);
					$transport->setPassword($_ENV['MAIL_PASSWORD']);

					if (!empty($_ENV['MAIL_TLS'])) {
						$transport->setEncryption('tls');
					}
				}
				elseif ($_ENV['MAIL_TRANSPORT'] === 'sendmail') {
					$sendmailPath = ini_get('sendmail_path');

					if (empty($sendmailPath)) {
						$sendmailPath = '/usr/sbin/sendmail';
					}

					$transport = \Swift_SendmailTransport::newInstance($sendmailPath);
				}
				elseif ($_ENV['MAIL_TRANSPORT'] === 'php') {
					$transport = \Swift_MailTransport::newInstance();
				}
			}

			if (isset($transport)) {
				$this->mail = \Swift_Mailer::newInstance($transport);
			}
		}

		// return the instance
		return $this->mail;
	}
public function mail() {
		// if the instance has not been created yet
		if (!isset($this->mail)) {
			// create the instance

			$transport = null;

			if (isset($_ENV['MAIL_TRANSPORT'])) {
				if ($_ENV['MAIL_TRANSPORT'] === 'smtp') {
					$transport = \Swift_SmtpTransport::newInstance();
					$transport->setHost($_ENV['MAIL_HOST']);
					$transport->setPort($_ENV['MAIL_PORT']);
					$transport->setUsername($_ENV['MAIL_USERNAME']);
					$transport->setPassword($_ENV['MAIL_PASSWORD']);

					if (!empty($_ENV['MAIL_TLS'])) {
						$transport->setEncryption('tls');
					}
				}
				elseif ($_ENV['MAIL_TRANSPORT'] === 'sendmail') {
					$sendmailPath = ini_get('sendmail_path');

					if (empty($sendmailPath)) {
						$sendmailPath = '/usr/sbin/sendmail';
					}

					$transport = \Swift_SendmailTransport::newInstance($sendmailPath);
				}
				elseif ($_ENV['MAIL_TRANSPORT'] === 'php') {
					$transport = \Swift_MailTransport::newInstance();
				}
			}

			if (isset($transport)) {
				$this->mail = \Swift_Mailer::newInstance($transport);
			}
		}

		// return the instance
		return $this->mail;
	}
public function mail ( ) { // if the instance has not been created yet if ( ! isset ( $ this -> mail ) ) { // create the instance $ transport = null ; if ( isset ( $ _ENV [ 'MAIL_TRANSPORT' ] ) ) { if ( $ _ENV [ 'MAIL_TRANSPORT' ] === 'smtp' ) { $ transport = \ Swift_SmtpTransport :: newInstance ( ) ; $ transport -> setHost ( $ _ENV [ 'MAIL_HOST' ] ) ; $ transport -> setPort ( $ _ENV [ 'MAIL_PORT' ] ) ; $ transport -> setUsername ( $ _ENV [ 'MAIL_USERNAME' ] ) ; $ transport -> setPassword ( $ _ENV [ 'MAIL_PASSWORD' ] ) ; if ( ! empty ( $ _ENV [ 'MAIL_TLS' ] ) ) { $ transport -> setEncryption ( 'tls' ) ; } } elseif ( $ _ENV [ 'MAIL_TRANSPORT' ] === 'sendmail' ) { $ sendmailPath = ini_get ( 'sendmail_path' ) ; if ( empty ( $ sendmailPath ) ) { $ sendmailPath = '/usr/sbin/sendmail' ; } $ transport = \ Swift_SendmailTransport :: newInstance ( $ sendmailPath ) ; } elseif ( $ _ENV [ 'MAIL_TRANSPORT' ] === 'php' ) { $ transport = \ Swift_MailTransport :: newInstance ( ) ; } } if ( isset ( $ transport ) ) { $ this -> mail = \ Swift_Mailer :: newInstance ( $ transport ) ; } } // return the instance return $ this -> mail ; }
Returns the mailing component

@return \Swift_Mailer the mailing component
Returns the mailing component