TODO

@return Mail\MailSystem.php
176475
private function getMailSystem()
    {
        if (isset($this->config['mail']) && isset($this->config['mail']['mailsystem'])) {
            $system = $this->config['mail']['mailsystem'];
            $class = 'GLFramework\\Mail\\' . $system;
            if (class_exists($class)) {
                return new $class($this->config);
            }
        }
        return new Mail\Mail($this->config);
    }
660657
public function getEmail()
    {
        $oHttpCodes = Factory::service('HttpCodes');

        if (!userHasPermission('admin:auth:accounts:browse')) {
            throw new ApiException(
                'You are not authorised to browse users',
                $oHttpCodes::STATUS_UNAUTHORIZED
            );
        }

        $oInput = Factory::service('Input');
        $sEmail = $oInput->get('email');

        if (!valid_email($sEmail)) {
            throw new ApiException(
                '"' . $sEmail . '" is not a valid email',
                $oHttpCodes::STATUS_BAD_REQUEST
            );
        }

        $oUserModel = Factory::model(static::CONFIG_MODEL_NAME, static::CONFIG_MODEL_PROVIDER);
        $oUser      = $oUserModel->getByEmail($sEmail);

        if (empty($oUser)) {
            throw new ApiException(
                'No user found for email "' . $sEmail . '"',
                $oHttpCodes::STATUS_NOT_FOUND
            );
        }

        return Factory::factory('ApiResponse', 'nails/module-api')
            ->setData($this->formatObject($oUser));
    }
1291074
public function toString()
    {
        $credentials = array();
        $credentials['E-mail'] = $this->email;
        $credentials['Token'] = $this->token;
        return implode(' - ', $credentials);
    }
588900
public function send() {
    $mime=$this->buildRawMime(false);
    
    // possibly convert the subject
    $subject = $this->subject;
    if ($this->subject_charset) {
      $subject=$this->encodeSubject($subject,$this->subject_charset);
    }
    
    // workaround on fix for PHP bug #68776
    // we have to split the headers from the body
    list($header_str, $body_str) = explode("\n\n",$mime,2);
    
    if (!empty($this->from)) {
      $extra_param = "-f". self::extractMailAddress($this->from);
      return mail($this->to, $subject, $body_str, $header_str, $extra_param);
    } else {
      return mail($this->to, $subject, $body_str, $header_str);
    }
  }
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;
    }
884707
public function getEmail(){
		$result = null;
		if (isset($this->userInfo[$this->socialFieldsMap['email']])) {
			$result = $this->userInfo[$this->socialFieldsMap['email']];
			}
		return $result;
		}
692867
public function get() {
        $messages = MessageCollection::make([]);

        try {
            $this->generate_query();

            /**
             * Don't set the charset if it isn't used - prevent strange outlook mail server errors
             * @see https://github.com/Webklex/laravel-imap/issues/100
             */
            if($this->getCharset() === null){
                $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID);
            }else{
                $available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), IMAP::SE_UID, $this->getCharset());
            }

            if ($available_messages !== false) {

                $available_messages = collect($available_messages);
                $options = config('imap.options');

                if(strtolower($options['fetch_order']) === 'desc'){
                    $available_messages = $available_messages->reverse();
                }

                $query =& $this;

                $available_messages->forPage($this->page, $this->limit)->each(function($msgno, $msglist) use(&$messages, $options, $query) {
                    $oMessage = new Message($msgno, $msglist, $query->getClient(), $query->getFetchOptions(), $query->getFetchBody(), $query->getFetchAttachment(), $query->getFetchFlags());
                    switch ($options['message_key']){
                        case 'number':
                            $message_key = $oMessage->getMessageNo();
                            break;
                        case 'list':
                            $message_key = $msglist;
                            break;
                        default:
                            $message_key = $oMessage->getMessageId();
                            break;

                    }
                    $messages->put($message_key, $oMessage);
                });
            }

            return $messages;
        } catch (\Exception $e) {
            throw new GetMessagesFailedException($e->getMessage());
        }
    }
39932
public function email()
    {
        $this->raw();

        $email = null;
        $person = $this->person();

        if (isset($person->emails)) {
            if (isset($person->emails->email)) {
                if (is_array($person->emails->email) && isset($person->emails->email[0])) {
                    $email = $person->emails->email[0]->value;
                }
            }
        }

        return $email;
    }
972987
public function getTransport()
    {
        $config = $this->config;
        $transport = \Swift_SmtpTransport::newInstance($config['mail']['hostname'], $config['mail']['port']);
        $transport->setUsername($config['mail']['username']);
        $transport->setPassword($this->getPassword());
        if(isset($config['mail']['encryption'])) {
            $transport->setEncryption($config['mail']['encryption']);
        }
        return $transport;
    }
1145646
public function getMessageStructure()
	{
		if( !$this->structure )
			$this->structure	= imap_fetchstructure( $this->stream, $this->messageNumber );
		return $this->structure;
	}
153047
public function formatMailChimp()
    {
        $options = $this->options;
        if (!empty($this->getMergeFields())) {
            $options = array_merge([
                'merge_fields' => $this->getMergeFields()
            ], $options);
        }

        return array_merge([
            'email_address' => $this->getEmail()
        ], $options);
    }
539210
public static function getInstance() {

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

			self::$instance	= new MailProperties();

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

		return self::$instance;
	}
1099676
private function formatNotify() {

		$notify = null;

		if(true === isset($this -> headers['notify'])) {

			$notify = $this -> emailsToString($this -> headers['notify']);

			if(null === $notify) {

				if(true === isset($this -> headers['from'])) {
					$notify = $this -> emailsToString($this -> headers['from']);
				}
				else {
					$notify = ini_get('sendmail_from');
				}
			}
		}
		
		return $notify;
	}
1211732
private function getEmailHtml()
    {
        return $this->app['twig']->render(
            'email/pingtest.twig',
            [
                'sitename' => $this->app['config']->get('general/sitename'),
                'user'     => $this->options['user']['displayname'],
                'ip'       => $this->options['ip'],
            ]
        );
    }
896937
public function getMailingListService()
    {
        if (!array_key_exists('mailing_list', $this->services)) {
            $this->services['mailing_list'] = new MailingList($this->httpClient, $this->key);
        }

        return $this->services['mailing_list'];
    }
346372
public function email() {
        $this->check_role = 'email';
        $result = $this->filter($this->value, FILTER_VALIDATE_EMAIL);
        $this->checkResult($result);
        return $this;
    }
38679
public function getEmailContent()
    {
        $mailContent = '';
        // Text content
        if (!empty($this->textContent)) {
            $mailContent .= '--' . $this->boundary . PHP_EOL;
            $mailContent .= 'Content-Type: text/plain; charset="' . $this->charset . '"' . PHP_EOL;
            $mailContent .= 'Content-Transfer-Encoding: 8bit' . PHP_EOL . PHP_EOL;
            $mailContent .= $this->textContent . PHP_EOL . PHP_EOL;
        }
        // Html content
        if (!empty($this->htmlContent)) {
            $mailContent .= '--' . $this->boundary . PHP_EOL;
            $mailContent .= 'Content-Type: text/html; charset="' . $this->charset . '"' . PHP_EOL;
            $mailContent .= 'Content-Transfer-Encoding: 8bit' . PHP_EOL . PHP_EOL;
            $mailContent .= $this->htmlContent . PHP_EOL . PHP_EOL;
        }
        $mailContent .= '--' . $this->boundary . '--';
        return $mailContent;
    }