Returns an instance of the mail object

@return Email\SwiftAbstract
434696
public function getMailer()
    {
        if (is_null($this->mailer)) {
            if(class_exists('\Swift'))
            {
                if(version_compare(\Swift::VERSION, 4, '<=') && version_compare(\Swift::VERSION, 3, '>='))
                {
                    $mailer = new Email\Swift3($this->config);
                }
                else {
                    $mailer = new Email\Swift5($this->config);
                }
            }
            else {
                $mailer = new Email\Swift5($this->config); 
            }
            
            $this->mailer = $mailer;
        }
        
        return $this->mailer;
    }
762998
public function getMessage()
    {
        if ($this->EmailMessage) {
            return sprintf('%s %s', rtrim($this->EmailMessage), $this->getCurrentPageLink());
        }
        
        return $this->getCurrentPageLink();
    }
879393
public function getEmail() : ?string 
    {
        if ( ! $this->hasEmail()) {
            $this->setEmail($this->getDefaultEmail());
        }
        return $this->email;
    }
1338548
public function init()
    {
        if (!class_exists('Swift_MailTransport')) {
            throw new \Exception('SwiftMailer need to be installed');
        }
        $transport = null;
        switch ($this->config['transport']) {
            case self::TRANSPORT_SENDMAIL:
                $transport = new \Swift_SendmailTransport();
                break;
            case self::TRANSPORT_SMTP:
                $transport = (new \Swift_SmtpTransport(isset($this->config['host'])
                            ? $this->config['host'] : 'localhost',
                    isset($this->config['port']) ? $this->config['port'] : 25,
                    isset($this->config['security']) ? $this->config['security']
                            : ''))
                    ->setUsername($this->config['username'])
                    ->setPassword($this->config['password']);
                break;
            case self::TRANSPORT_MAIL:
            default:
                $transport = new \Swift_MailTransport();
        }
        $this->mailer = new \Swift_Mailer($transport);
        return $this;
    }
1265187
public static function to()
    {
        $args = func_get_args();

        $receivers = [];

        foreach ($args as $arg) {
            if (is_string($arg)) {
                $receivers[] = $arg;
            } elseif (is_array($arg)) {
                foreach ($arg as $value) {
                    $receivers[] = $value;
                }
            }
        }

        $mail = new self();
        $mail->setDestination($receivers);

        return $mail;
    }
224854
public function getSMTPObject()
    {
        if ($this->_smtp) {
            return $this->_smtp;
        }

        $this->_smtp = new Net_SMTP(
            $this->_params['host'],
            $this->_params['port'],
            $this->_params['localhost']
        );

        /* Set pipelining. */
        if ($this->_params['pipelining']) {
            $this->_smtp->pipelining = true;
        }

        /* If we still don't have an SMTP object at this point, fail. */
        if (!($this->_smtp instanceof Net_SMTP)) {
            throw new Horde_Mail_Exception('Failed to create a Net_SMTP object', self::ERROR_CREATE);
        }

        /* Configure the SMTP connection. */
        if ($this->_params['debug']) {
            $this->_smtp->setDebug(true);
        }

        /* Attempt to connect to the configured SMTP server. */
        $res = $this->_smtp->connect($this->_params['timeout']);
        if ($res instanceof PEAR_Error) {
            $this->_error('Failed to connect to ' . $this->_params['host'] . ':' . $this->_params['port'], $res, self::ERROR_CONNECT);
        }

        /* Attempt to authenticate if authentication has been enabled. */
        if ($this->_params['auth']) {
            $method = is_string($this->_params['auth'])
                ? $this->_params['auth']
                : '';

            $res = $this->_smtp->auth($this->_params['username'], $this->_params['password'], $method);
            if ($res instanceof PEAR_Error) {
                $this->_error("$method authentication failure", $res, self::ERROR_AUTH);
            }
        }

        return $this->_smtp;
    }
539210
public static function getInstance() {

		if( !isset( self::$instance ) ) {

			self::$instance	= new MailProperties();

			self::$instance->init( CoreGlobal::CONFIG_MAIL );
		}

		return self::$instance;
	}
184210
public static function getInstance() {

		if( !isset( self::$instance ) ) {

			self::$instance	= new TwitterMetaProperties();

			self::$instance->init( 'twitter-meta' );
		}

		return self::$instance;
	}
1030592
protected function sendViaSwiftMailer()
    {
        $factory = new MailerFactory($this->config->get('phpci'));
        $mailer = $factory->getSwiftMailerFromConfig();

        $message = \Swift_Message::newInstance($this->subject)
            ->setFrom($this->getFrom())
            ->setTo($this->emailTo)
            ->setBody($this->body);

        if ($this->isHtml) {
            $message->setContentType('text/html');
        }

        if (is_array($this->emailCc) && count($this->emailCc)) {
            $message->setCc($this->emailCc);
        }

        return $mailer->send($message);
    }
776767
public function getEmailSubject() : string
    {
        $result = sprintf(
            '%s: %s',
            Inflector::singularize($this->table->getAlias()),
            $this->getDisplayValue()
        );

        if (! $this->entity->isNew()) {
            $result = sprintf('(Updated) %s', $result);
        }

        return $result;
    }
1342656
public static function getInstance(){
		if(!is_object(self::$instance)){
			if(DEBUG_CACHE){
				BLog::addToLog('[BCache]: Creating cache object ('.CACHE_TYPE.')...');
				}
			switch(CACHE_TYPE){
				case 'files':
					self::$instance=new \Brilliant\Cache\BCacheFiles();
					break;
				case 'memcache':
					bimport('cache.memcache');
					self::$instance=new \Brilliant\Cache\BCacheMemcache();
					break;
				case 'memcached':
					bimport('cache.memcached');
					self::$instance=new \Brilliant\Cache\BCacheMemcached();
					break;
				default:
					self::$instance=NULL;
					break;
				}
			}
		return self::$instance;
		}
926673
public function getSMTPInstance()
    {
        if (!is_object($this->smtp)) {
            $this->smtp = new Mail\Smtp();
        }
        return $this->smtp;
    }
289882
protected function getSubject()
    {
        // the form could contain arrays which are incompatible with the template function
        $templatableItems = array_filter($this->form->data(), function ($item) {
            return is_scalar($item);
        });

        $subject = Str::template($this->option('subject', I18n::translate('uniform-email-subject')), $templatableItems);

        // Remove newlines to prevent malicious modifications of the email header.
        return str_replace("\n", '', $subject);
    }
499658
public function convert(Email $email): \Swift_Message
    {
        $message = $this->createInstance()->setSubject($email->getSubject());
        $message->setBoundary($boundary = \md5(\uniqid()));

        $this->addAddresses($email, $message);
        $this->addParts($email, $message, $boundary);
        $this->addHeaders($email, $message);
        $this->addAttachments($email, $message);

        if ($contentType = $email->getContentType()) {
            $message->setContentType($contentType);
        }

        return $message;
    }
757227
public function getContactSubject()
    {
        if ($this->_sContactSubject === null) {
            $this->_sContactSubject = Registry::getConfig()->getRequestParameter('c_subject');
        }

        return $this->_sContactSubject;
    }
273069
public function getSwiftMailerFromConfig()
    {
        $encryptionType = $this->getMailConfig('smtp_encryption');

        // Workaround issue where smtp_encryption could == 1 in the past by
        // checking it is a valid transport
        if ($encryptionType && !in_array($encryptionType, stream_get_transports())) {
            $encryptionType = null;
        }

        /** @var \Swift_SmtpTransport $transport */
        $transport = \Swift_SmtpTransport::newInstance(
            $this->getMailConfig('smtp_address'),
            $this->getMailConfig('smtp_port'),
            $encryptionType
        );
        $transport->setUsername($this->getMailConfig('smtp_username'));
        $transport->setPassword($this->getMailConfig('smtp_password'));

        return \Swift_Mailer::newInstance($transport);
    }
981800
public function getSMTPObject()
    {
        if (is_object($this->_smtp) !== false) {
            return $this->_smtp;
        }

        include_once 'Net/SMTP.php';
        $this->_smtp = new Net_SMTP($this->host,
                                     $this->port,
                                     $this->localhost,
                                     $this->pipelining,
                                     0,
                                     $this->socket_options);

        /* If we still don't have an SMTP object at this point, fail. */
        if (is_object($this->_smtp) === false) {
            return PEAR::raiseError('Failed to create a Net_SMTP object',
                                    PEAR_MAIL_SMTP_ERROR_CREATE);
        }

        /* Configure the SMTP connection. */
        if ($this->debug) {
            $this->_smtp->setDebug(true);
        }

        /* Attempt to connect to the configured SMTP server. */
        if (PEAR::isError($res = $this->_smtp->connect($this->timeout))) {
            $error = $this->_error('Failed to connect to ' .
                                   $this->host . ':' . $this->port,
                                   $res);
            return PEAR::raiseError($error, PEAR_MAIL_SMTP_ERROR_CONNECT);
        }

        /* Attempt to authenticate if authentication has been enabled. */
        if ($this->auth) {
            $method = is_string($this->auth) ? $this->auth : '';

            if (PEAR::isError($res = $this->_smtp->auth($this->username,
                                                        $this->password,
                                                        $method))) {
                $error = $this->_error("$method authentication failure",
                                       $res);
                $this->_smtp->rset();
                return PEAR::raiseError($error, PEAR_MAIL_SMTP_ERROR_AUTH);
            }
        }

        return $this->_smtp;
    }