Returns the internal Zend mail object.

@return Zend_Mail Zend mail object
170788
public function getObject()
	{
		if( !empty( $this->_embedded ) )
		{
			$parts = array();

			if( $this->_html != null )
			{
				$part = new Zend_Mime_Part( $this->_html );

				$part->charset = $this->_object->getCharset();
				$part->encoding = Zend_Mime::ENCODING_QUOTEDPRINTABLE;
				$part->disposition = Zend_Mime::DISPOSITION_INLINE;
				$part->type = Zend_Mime::TYPE_HTML;

				$parts = array( $part );
			}

			$msg = new Zend_Mime_Message();
			$msg->setParts( array_merge( $parts, $this->_embedded ) );

			// create html body (text and maybe embedded), modified afterwards to set it to multipart/related
			$this->_object->setBodyHtml( $msg->generateMessage() );

			$related = $this->_object->getBodyHtml();
			$related->type = Zend_Mime::MULTIPART_RELATED;
			$related->encoding = Zend_Mime::ENCODING_8BIT;
			$related->boundary = $msg->getMime()->boundary();
			$related->disposition = null;
			$related->charset = null;
		}
		else if( $this->_html != null )
		{
			$this->_object->setBodyHtml( $this->_html );
		}

		return $this->_object;
	}
722902
protected function get_mail_type()
	{
		$return = $this->config['is_html'] ? 'html' : 'plain' ;
		$alt = trim($this->alt_body);
		$return .= ($this->config['is_html'] and ! empty($alt)) ? '_alt' : '';
		$return .= ($this->config['is_html'] and count($this->attachments['inline'])) ? '_inline' : '';
		$return .= (count($this->attachments['attachment'])) ? '_attach' : '';
		return $return;
	}
27145
public function getInternalResponse()
    {
        if (null === $this->internalResponse) {
            @trigger_error(sprintf('Calling the "%s()" method before the "request()" one is deprecated since Symfony 4.1 and will throw an exception in 5.0.', \get_class($this).'::'.__FUNCTION__), E_USER_DEPRECATED);
            // throw new BadMethodCallException(sprintf('The "request()" method must be called before "%s()".', __METHOD__));
        }

        return $this->internalResponse;
    }
499464
protected function emailFactory()
    {
        if (!isset($this->emailFactory)) {
            throw new RuntimeException(sprintf(
                'Email Factory is not defined for [%s]',
                get_class($this)
            ));
        }

        return $this->emailFactory;
    }
927729
public function getFromForm()
    {
        if ($this->form !== null) {
            $this->notification_email = $this->form->notification_email;
            if ($this->form->full_name !== '') {
                $this->full_name = $this->form->full_name;
            }
            $this->display_name = $this->form->display_name;
            $this->tz = $this->form->tz;
            $this->location = TextHelper::clearText($this->form->location);
            $this->about = TextHelper::clearText($this->form->about);
            $this->custom_fields = $this->form->custom_fields;
        }
    }
1208060
static function internalCharset()
    {
        $realCharset =& $GLOBALS['eZTextCodecInternalCharsetReal'];
        if ( !isset( $realCharset ) )
        {
            if ( !isset( $GLOBALS['eZTextCodecInternalCharset'] ) )
            {
                $i18n = eZINI::instance( 'i18n.ini', '', false );
                $charsetCode = $i18n->variable( 'CharacterSettings', 'Charset' );
            }
            else
                $charsetCode = $GLOBALS['eZTextCodecInternalCharset'];
            $realCharset = eZCharsetInfo::realCharsetCode( $charsetCode );
        }
        return $realCharset;
    }
2985
public function envoyer() {
        $this->setEntete();
        return mail($this->destinataire_email, $this->sujet, $this->message, $this->entete);
    }
614329
public function resetMailData()
    {
        // Reset the mail values
        $this->subject           = null;
        $this->body              = null;
        $this->headers           = [];
        return $this;
    }
263657
public function getSentMIMEMessage()
    {
        return rtrim($this->MIMEHeader . $this->mailHeader, "\n\r") . self::CRLF . self::CRLF . $this->MIMEBody;
    }
31949
public static function getDefault()
    {
        $smtp = new self(
            config('mail.host'),
            config('mail.port'),
            config('mail.encryption'),
            config('mail.username'),
            config('mail.password'),
            config('mail.from')['adresse'],
            config('mail.from')['name']
            );

        // static::check($smtp);

        return $smtp;
    }
490705
public function getContentIterator()
    {
        // Initializing output array
        $output = new \ArrayIterator();

        // Getting total number of messages
        $maxMessage = $this->storage->countMessages();

        for($i=1; $i<=$maxMessage; $i++) {
            // Getting the message object
            $message = $this->storage->getMessage($i);

            if ($message instanceof \Zend\Mail\Storage\Message) {
                // Wrapping the result object into an appropriate ResourceInterface instance
                try {
                    $popMessage = new PopMessage();
                    $popMessage->init($this->getName(), $i, $message);
                } catch (\Exception $e) {
                    throw new Exception\SourceGetContentException(
                        sprintf(
                            'Error while getting the content for the resource unique id \'%s\'. Exception is: \'%s\'.',
                            $i,
                            $e->getMessage()
                        )
                    );
                }

                // Adding the wrapping object to the result iterator
                $output->append($popMessage);
            }
        }

        // Returning the result iterator
        return $output;
    }
903194
protected function default()
    {
        $default = ! empty($emails = $this->getPossibleEmails()) ? $emails[0]: '';
        return fp_env($this->envVar()) ? fp_env($this->envVar()) : $default;
    }
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;
    }
1121016
public function getMailInstance($config = null)
    {
        if (!$config) {
            $config = $this->config('config');
        }

        $sender = Configure::read('CM.Mail.sender');

        $object = $this->EmailObject;

        $object->sender($sender['email'], $sender['name']);

        if (Configure::read('CM.Mail.transport')) {
            $object->transport(Configure::read('CM.Mail.transport'));
        }

        return $object;
    }
180802
protected function getTemplater()
    {
        if (null !== $this->container) {
            $this->templater = $this->container->get('fxp_mailer.mail_templater');
            $this->container = null;
        }

        return $this->templater;
    }
574901
private function sendMail() {

		// check for configured mailer

		if(is_null($this->mailer) && !is_null(Application::getInstance()->getConfig()->mail->mailer)) {

			$mailer = Application::getInstance()->getConfig()->mail->mailer;
			$reflection = new \ReflectionClass(str_replace('/', '\\', $mailer->class));
			
			$port = isset($mailer->port) ? $mailer->port : null;
			$encryption = isset($mailer->encryption) ? $mailer->encryption : null;

			$this->mailer = $reflection->newInstanceArgs([$mailer->host, $port, $encryption]);

			if(isset($mailer->auth_type)) {
				$this->mailer->setCredentials($mailer->user, $mailer->pass, $mailer->auth_type);
			}
			else {
				$this->mailer->setCredentials($mailer->user, $mailer->pass);
			}
		}

		if(is_null($this->mailer)) {

			// use PHP's own mail() function

			$headers = [];

			foreach($this->headers as $k => $v) {
				$headers[] = iconv_mime_encode($k, $v);
			}

			mb_internal_encoding($this->encoding);

			// @todo ensure receiver to be RFC conforming

			return mail(
				implode(',', $this->receiver),
				mb_encode_mimeheader($this->subject, mb_internal_encoding(), 'Q'),
				$this->msg,
				implode(self::CRLF, $headers)
			);
		}

		else {

			// send mail with configured mailer

			try {
				$this->mailer->connect();

				$this->mailer->setFrom($this->sender);
				$this->mailer->setTo(array_merge((array) $this->receiver, $this->cc, $this->bcc));
				$this->mailer->setHeaders(array_merge(
					[
						'To' => implode(',', (array) $this->receiver),
						'Subject' => $this->subject
					],
					$this->headers
				));
				$this->mailer->setMessage($this->msg);
				$this->mailer->send();

				$this->mailer->close();
				return true;
			}

			catch(MailerException $e) {
				$this->mailer->close();
				return $e->getMessage();
			}
		}
	}
673631
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;
	}