예제 #1
0
파일: Email.php 프로젝트: afterlogic/mailso
 /**
  * @access private
  *
  * @param string $sEmail
  * @param string $sDisplayName = ''
  * @param string $sRemark = ''
  *
  * @throws \MailSo\Base\Exceptions\InvalidArgumentException
  */
 private function __construct($sEmail, $sDisplayName = '', $sRemark = '')
 {
     if (!\MailSo\Base\Validator::NotEmptyString($sEmail, true)) {
         throw new \MailSo\Base\Exceptions\InvalidArgumentException();
     }
     $this->sEmail = \MailSo\Base\Utils::IdnToAscii(\trim($sEmail), true);
     $this->sDisplayName = \trim($sDisplayName);
     $this->sRemark = \trim($sRemark);
 }
예제 #2
0
 /**
  * @param array $oItem
  * @param array $aPics
  *
  * @return array|null
  */
 private function convertGoogleJsonContactToResponseContact($oItem, &$aPics)
 {
     $mResult = null;
     if (!empty($oItem['gd$email'][0]['address'])) {
         $mEmail = \MailSo\Base\Utils::IdnToAscii($oItem['gd$email'][0]['address'], true);
         if (\is_array($oItem['gd$email']) && 1 < \count($oItem['gd$email'])) {
             $mEmail = array();
             foreach ($oItem['gd$email'] as $oEmail) {
                 if (!empty($oEmail['address'])) {
                     $mEmail[] = \MailSo\Base\Utils::IdnToAscii($oEmail['address'], true);
                 }
             }
         }
         $sImg = '';
         if (!empty($oItem['link']) && \is_array($oItem['link'])) {
             foreach ($oItem['link'] as $oLink) {
                 if ($oLink && isset($oLink['type'], $oLink['href'], $oLink['rel']) && 'image/*' === $oLink['type'] && '#photo' === \substr($oLink['rel'], -6)) {
                     $sImg = $oLink['href'];
                     break;
                 }
             }
         }
         $mResult = array('email' => $mEmail, 'name' => !empty($oItem['title']['$t']) ? $oItem['title']['$t'] : '');
         if (0 < \strlen($sImg)) {
             $sHash = \RainLoop\Utils::EncodeKeyValues(array('url' => $sImg, 'type' => 'google_access_token'));
             $mData = array();
             if (isset($aPics[$sHash])) {
                 $mData = $aPics[$sHash];
                 if (!\is_array($mData)) {
                     $mData = array($mData);
                 }
             }
             if (\is_array($mEmail)) {
                 $mData = \array_merge($mData, $mEmail);
                 $mData = \array_unique($mData);
             } else {
                 if (0 < \strlen($mEmail)) {
                     $mData[] = $mEmail;
                 }
             }
             if (\is_array($mData)) {
                 if (1 === \count($mData) && !empty($mData[0])) {
                     $aPics[$sHash] = $mData[0];
                 } else {
                     if (1 < \count($mData)) {
                         $aPics[$sHash] = $mData;
                     }
                 }
             }
         }
     }
     return $mResult;
 }
예제 #3
0
 /**
  * @param string $sParentEmail
  *
  * @return void
  */
 public function SetParentEmail($sParentEmail)
 {
     $this->sParentEmail = \trim(\MailSo\Base\Utils::IdnToAscii($sParentEmail, true));
 }
예제 #4
0
 /**
  * @return bool
  */
 public function RawAvatar()
 {
     $sData = '';
     $sRawKey = (string) $this->GetActionParam('RawKey', '');
     $sRawKey = \urldecode($sRawKey);
     $this->verifyCacheByKey($sRawKey);
     if (0 < \strlen($sRawKey) && \preg_match('/^[^@]+@([^@]+)$/', $sRawKey)) {
         $sEmail = \MailSo\Base\Utils::IdnToAscii($sRawKey, true);
         $iCode = 0;
         $sContentType = '';
         $sData = $this->Http()->GetUrlAsString('http://gravatar.com/avatar/' . \md5($sEmail) . '.jpg?s=80&d=404', null, $sContentType, $iCode, $this->Logger(), 5, $this->Config()->Get('labs', 'curl_proxy', ''), $this->Config()->Get('labs', 'curl_proxy_auth', ''));
         $sContentType = \strtolower(\trim($sContentType));
         if (200 !== $iCode || empty($sData) || !\in_array($sContentType, array('image/jpeg', 'image/jpg', 'image/png'))) {
             $sData = '';
             $aMatch = array();
             if (\preg_match('/^[^@]+@([a-z0-9\\-\\.]+)$/', $sEmail, $aMatch) && !empty($aMatch[1])) {
                 $sDomain = $aMatch[1];
                 if (\file_exists(APP_VERSION_ROOT_PATH . 'app/resources/images/services/' . $sDomain . '.png')) {
                     $sContentType = 'image/png';
                     $sData = \file_get_contents(APP_VERSION_ROOT_PATH . 'app/resources/images/services/' . $sDomain . '.png');
                 }
             }
         }
     }
     if (empty($sData) || empty($sContentType)) {
         $sContentType = 'image/png';
         $sData = \file_get_contents(APP_VERSION_ROOT_PATH . 'app/resources/images/empty-contact.png');
     }
     $this->cacheByKey($sRawKey);
     \header('Content-Type: ' . $sContentType);
     echo $sData;
     return true;
 }
 /**
  * @param string $sEmail
  *
  * @return \RainLoop\Identity
  */
 public function SetEmail($sEmail)
 {
     $this->sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail, true);
     return $this;
 }
예제 #6
0
 /**
  * @param string $sEmail
  *
  * @return bool
  */
 public static function ClearUserData($sEmail)
 {
     if (0 < \strlen($sEmail)) {
         $sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail);
         $oStorageProvider = \RainLoop\Api::Actions()->StorageProvider();
         if ($oStorageProvider && $oStorageProvider->IsActive()) {
             $oStorageProvider->DeleteStorage($sEmail);
         }
         if (\RainLoop\Api::Actions()->AddressBookProvider() && \RainLoop\Api::Actions()->AddressBookProvider()->IsActive()) {
             \RainLoop\Api::Actions()->AddressBookProvider()->DeleteAllContacts($sEmail);
         }
         return true;
     }
     return false;
 }
 /**
  * @param string $sEmail
  *
  * @return bool
  */
 public static function ClearUserData($sEmail)
 {
     if (0 < \strlen($sEmail)) {
         $sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail);
         $oStorageProvider = \RainLoop\Api::Actions()->StorageProvider();
         if ($oStorageProvider && $oStorageProvider->IsActive()) {
             // TwoFactor Auth User Data
             $oStorageProvider->Clear(null, \RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY, \RainLoop\KeyPathHelper::TwoFactorAuthUserData($sEmail));
             // Accounts list
             $oStorageProvider->Clear(null, \RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY, \RainLoop\KeyPathHelper::WebmailAccounts($sEmail));
             // Contact sync data
             $oStorageProvider->Clear($sEmail, \RainLoop\Providers\Storage\Enumerations\StorageType::CONFIG, 'contacts_sync');
         }
         \RainLoop\Api::Actions()->SettingsProvider()->ClearByEmail($sEmail);
         if (\RainLoop\Api::Actions()->AddressBookProvider() && \RainLoop\Api::Actions()->AddressBookProvider()->IsActive()) {
             \RainLoop\Api::Actions()->AddressBookProvider()->DeleteAllContactsAndTags($sEmail);
         }
         return true;
     }
     return false;
 }
예제 #8
0
 /**
  * @param string $sLogin
  * @param string $sPassword
  * @param string $sProxyAuthUser = ''
  * @param bool $bUseAuthPlainIfSupported = false
  *
  * @return \MailSo\Imap\ImapClient
  *
  * @throws \MailSo\Base\Exceptions\InvalidArgumentException
  * @throws \MailSo\Net\Exceptions\Exception
  * @throws \MailSo\Imap\Exceptions\Exception
  */
 public function Login($sLogin, $sPassword, $sProxyAuthUser = '', $bUseAuthPlainIfSupported = false)
 {
     if (!\MailSo\Base\Validator::NotEmptyString($sLogin, true) || !\MailSo\Base\Validator::NotEmptyString($sPassword, true)) {
         $this->writeLogException(new \MailSo\Base\Exceptions\InvalidArgumentException(), \MailSo\Log\Enumerations\Type::ERROR, true);
     }
     $sLogin = \trim($sLogin);
     $sLogin = \MailSo\Base\Utils::IdnToAscii($sLogin);
     $sPassword = $sPassword;
     $this->sLogginedUser = $sLogin;
     try {
         if ($bUseAuthPlainIfSupported && $this->IsSupported('AUTH=PLAIN')) {
             if ($this->oLogger) {
                 $this->oLogger->AddSecret(\base64_encode("" . $sLogin . "" . $sPassword));
             }
             $this->SendRequestWithCheck('AUTHENTICATE', array('PLAIN', \base64_encode("" . $sLogin . "" . $sPassword)));
         } else {
             if ($this->oLogger) {
                 $this->oLogger->AddSecret($this->EscapeString($sPassword));
             }
             $this->SendRequestWithCheck('LOGIN', array($this->EscapeString($sLogin), $this->EscapeString($sPassword)));
         }
         //			else
         //			{
         //				$this->writeLogException(
         //					new \MailSo\Imap\Exceptions\LoginBadMethodException(),
         //					\MailSo\Log\Enumerations\Type::NOTICE, true);
         //			}
         if (0 < \strlen($sProxyAuthUser)) {
             $this->SendRequestWithCheck('PROXYAUTH', array($this->EscapeString($sProxyAuthUser)));
         }
     } catch (\MailSo\Imap\Exceptions\NegativeResponseException $oException) {
         $this->writeLogException(new \MailSo\Imap\Exceptions\LoginBadCredentialsException($oException->GetResponses(), '', 0, $oException), \MailSo\Log\Enumerations\Type::NOTICE, true);
     }
     $this->bIsLoggined = true;
     $this->aCapabilityItems = null;
     return $this;
 }
예제 #9
0
 /**
  * @return \MailSo\Smtp\SmtpClient
  *
  * @throws \MailSo\Net\Exceptions\Exception
  * @throws \MailSo\Smtp\Exceptions\Exception
  */
 public function Vrfy($sUser)
 {
     $sUser = \MailSo\Base\Utils::IdnToAscii(\MailSo\Base\Utils::Trim($sUser));
     $this->sendRequestWithCheck('VRFY', array(250, 251, 252), $sUser);
     return $this;
 }
예제 #10
0
 /**
  * @param string $sName
  * @param bool $bFindWithWildCard = false
  * @param bool $bCheckDisabled = true
  *
  * @return \RainLoop\Model\Domain|null
  */
 public function Load($sName, $bFindWithWildCard = false, $bCheckDisabled = true)
 {
     $mResult = null;
     $sDisabled = '';
     $sFoundedValue = '';
     $sRealFileName = $this->codeFileName($sName);
     if (\file_exists($this->sDomainPath . '/disabled')) {
         $sDisabled = @\file_get_contents($this->sDomainPath . '/disabled');
     }
     if (\file_exists($this->sDomainPath . '/' . $sRealFileName . '.ini') && (!$bCheckDisabled || 0 === \strlen($sDisabled) || false === \strpos(',' . $sDisabled . ',', ',' . \MailSo\Base\Utils::IdnToAscii($sName, true) . ','))) {
         $aDomain = \RainLoop\Utils::CustomParseIniFile($this->sDomainPath . '/' . $sRealFileName . '.ini');
         // fix misspellings (#119)
         if (\is_array($aDomain)) {
             if (isset($aDomain['smpt_host'])) {
                 $aDomain['smtp_host'] = $aDomain['smpt_host'];
             }
             if (isset($aDomain['smpt_port'])) {
                 $aDomain['smtp_port'] = $aDomain['smpt_port'];
             }
             if (isset($aDomain['smpt_secure'])) {
                 $aDomain['smtp_secure'] = $aDomain['smpt_secure'];
             }
             if (isset($aDomain['smpt_auth'])) {
                 $aDomain['smtp_auth'] = $aDomain['smpt_auth'];
             }
         }
         //---
         $mResult = \RainLoop\Model\Domain::NewInstanceFromDomainConfigArray($sName, $aDomain);
     } else {
         if ($bFindWithWildCard) {
             $sNames = $this->getWildcardDomainsLine();
             if (0 < \strlen($sNames)) {
                 if (\RainLoop\Plugins\Helper::ValidateWildcardValues(\MailSo\Base\Utils::IdnToUtf8($sName, true), $sNames, $sFoundedValue) && 0 < \strlen($sFoundedValue)) {
                     if (!$bCheckDisabled || 0 === \strlen($sDisabled) || false === \strpos(',' . $sDisabled . ',', ',' . $sFoundedValue . ',')) {
                         $mResult = $this->Load($sFoundedValue, false);
                     }
                 }
             }
         }
     }
     return $mResult;
 }
예제 #11
0
 /**
  * @param array $aData
  * @param bool $bAjax = false
  *
  * @return bool
  */
 public function FromJSON($aData, $bAjax = false)
 {
     if (isset($aData['Id'], $aData['Email']) && !empty($aData['Email'])) {
         $this->sId = $aData['Id'];
         $this->sEmail = $bAjax ? \MailSo\Base\Utils::IdnToAscii($aData['Email'], true) : $aData['Email'];
         $this->sName = isset($aData['Name']) ? $aData['Name'] : '';
         $this->sReplyTo = !empty($aData['ReplyTo']) ? $aData['ReplyTo'] : '';
         $this->sBcc = !empty($aData['Bcc']) ? $aData['Bcc'] : '';
         $this->sSignature = !empty($aData['Signature']) ? $aData['Signature'] : '';
         $this->bSignatureInsertBefore = isset($aData['SignatureInsertBefore']) ? $bAjax ? '1' === $aData['SignatureInsertBefore'] : !!$aData['SignatureInsertBefore'] : true;
         return true;
     }
     return false;
 }
예제 #12
0
 /**
  * @param string $sIncHost
  * @param int $iIncPort
  * @param int $iIncSecure
  * @param bool $bIncShortLogin
  * @param string $sOutHost
  * @param int $iOutPort
  * @param int $iOutSecure
  * @param bool $bOutShortLogin
  * @param bool $bOutAuth
  * @param string $sWhiteList = ''
  *
  * @return \RainLoop\Domain
  */
 public function UpdateInstance($sIncHost, $iIncPort, $iIncSecure, $bIncShortLogin, $sOutHost, $iOutPort, $iOutSecure, $bOutShortLogin, $bOutAuth, $sWhiteList = '')
 {
     $this->sIncHost = \MailSo\Base\Utils::IdnToAscii($sIncHost);
     $this->iIncPort = $iIncPort;
     $this->iIncSecure = $iIncSecure;
     $this->bIncShortLogin = $bIncShortLogin;
     $this->sOutHost = \MailSo\Base\Utils::IdnToAscii($sOutHost);
     $this->iOutPort = $iOutPort;
     $this->iOutSecure = $iOutSecure;
     $this->bOutShortLogin = $bOutShortLogin;
     $this->bOutAuth = $bOutAuth;
     $this->sWhiteList = \trim($sWhiteList);
     return $this;
 }
 /**
  * @return string
  */
 public function ServiceChange()
 {
     if ($this->Config()->Get('webmail', 'allow_additional_accounts', true)) {
         $oAccountToLogin = null;
         $sEmail = empty($this->aPaths[2]) ? '' : \urldecode(\trim($this->aPaths[2]));
         if (!empty($sEmail)) {
             $sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail);
             $oAccount = $this->oActions->GetAccount();
             if ($oAccount) {
                 $aAccounts = $this->oActions->GetAccounts($oAccount);
                 if (isset($aAccounts[$sEmail])) {
                     $oAccountToLogin = $this->oActions->GetAccountFromCustomToken($aAccounts[$sEmail], false, false);
                 }
             }
         }
         if ($oAccountToLogin) {
             $this->oActions->AuthProcess($oAccountToLogin);
         }
     }
     $this->oActions->Location('./');
     return '';
 }
예제 #14
0
 /**
  * @todo
  * @param string $sEmail
  *
  * @return bool
  */
 public static function ClearUserDateStorage($sEmail)
 {
     $sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail);
     // TwoFactor Auth User Data
     self::Actions()->StorageProvider()->Clear(null, \RainLoop\Providers\Storage\Enumerations\StorageType::NOBODY, \RainLoop\KeyPathHelper::TwoFactorAuthUserData($sEmail));
 }
예제 #15
0
 /**
  * @return array
  *
  * @throws \MailSo\Base\Exceptions\Exception
  */
 public function DoAccountDelete()
 {
     if (!$this->Config()->Get('webmail', 'allow_additional_accounts', true)) {
         return $this->FalseResponse(__FUNCTION__);
     }
     $oAccount = $this->getAccountFromToken();
     $sParentEmail = $oAccount->ParentEmailHelper();
     $sEmailToDelete = \trim($this->GetActionParam('EmailToDelete', ''));
     $sEmailToDelete = \MailSo\Base\Utils::IdnToAscii($sEmailToDelete, true);
     $aAccounts = $this->GetAccounts($oAccount);
     if (0 < \strlen($sEmailToDelete) && $sEmailToDelete !== $sParentEmail && \is_array($aAccounts) && isset($aAccounts[$sEmailToDelete])) {
         unset($aAccounts[$sEmailToDelete]);
         $oAccountToChange = null;
         if ($oAccount->Email() === $sEmailToDelete && !empty($aAccounts[$sParentEmail])) {
             $oAccountToChange = $this->GetAccountFromCustomToken($aAccounts[$sParentEmail], false, false);
             if ($oAccountToChange) {
                 $this->AuthProcess($oAccountToChange);
             }
         }
         $this->SetAccounts($oAccount, $aAccounts);
         return $this->TrueResponse(__FUNCTION__, array('Reload' => !!$oAccountToChange));
     }
     return $this->FalseResponse(__FUNCTION__);
 }
예제 #16
0
 /**
  * @param string $sEmail
  * @param bool $bSkipInsert = false
  * @param bool $bCache = true
  *
  * @return int
  */
 protected function getUserId($sEmail, $bSkipInsert = false, $bCache = true)
 {
     static $aCache = array();
     if ($bCache && isset($aCache[$sEmail])) {
         return $aCache[$sEmail];
     }
     $sEmail = \MailSo\Base\Utils::IdnToAscii(\trim($sEmail), true);
     if (empty($sEmail)) {
         throw new \InvalidArgumentException('Empty Email argument');
     }
     $oStmt = $this->prepareAndExecute('SELECT id_user FROM rainloop_users WHERE rl_email = :rl_email', array(':rl_email' => array($sEmail, \PDO::PARAM_STR)));
     $mRow = $oStmt->fetch(\PDO::FETCH_ASSOC);
     if ($mRow && isset($mRow['id_user']) && \is_numeric($mRow['id_user'])) {
         $iResult = (int) $mRow['id_user'];
         if (0 >= $iResult) {
             throw new \Exception('id_user <= 0');
         }
         if ($bCache) {
             $aCache[$sEmail] = $iResult;
         }
         return $iResult;
     }
     if (!$bSkipInsert) {
         $oStmt->closeCursor();
         $oStmt = $this->prepareAndExecute('INSERT INTO rainloop_users (rl_email) VALUES (:rl_email)', array(':rl_email' => array($sEmail, \PDO::PARAM_STR)));
         return $this->getUserId($sEmail, true);
     }
     throw new \Exception('id_user = 0');
 }
예제 #17
0
 /**
  * @return string
  */
 public function ServiceChange()
 {
     $oAccount = $this->oActions->GetAccount();
     if ($oAccount && $this->oActions->GetCapa(false, \RainLoop\Enumerations\Capa::ADDITIONAL_ACCOUNTS, $oAccount)) {
         $oAccountToLogin = null;
         $sEmail = empty($this->aPaths[2]) ? '' : \urldecode(\trim($this->aPaths[2]));
         if (!empty($sEmail)) {
             $sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail);
             $aAccounts = $this->oActions->GetAccounts($oAccount);
             if (isset($aAccounts[$sEmail])) {
                 $oAccountToLogin = $this->oActions->GetAccountFromCustomToken($aAccounts[$sEmail], false, false);
             }
         }
         if ($oAccountToLogin) {
             $this->oActions->AuthToken($oAccountToLogin);
         }
     }
     $this->oActions->Location('./');
     return '';
 }
예제 #18
0
 /**
  * @param string $sTo
  *
  * @return \MailSo\Smtp\SmtpClient
  *
  * @throws \MailSo\Net\Exceptions\Exception
  * @throws \MailSo\Smtp\Exceptions\Exception
  */
 public function Rcpt($sTo)
 {
     if (!$this->bMail) {
         $this->writeLogException(new Exceptions\RuntimeException('No sender reverse path has been supplied'), \MailSo\Log\Enumerations\Type::ERROR, true);
     }
     $sTo = \MailSo\Base\Utils::IdnToAscii($sTo, true);
     $this->sendRequestWithCheck('RCPT', array(250, 251), 'TO:<' . $sTo . '>');
     $this->bRcpt = true;
     return $this;
 }
예제 #19
0
 /**
  * @param string $sLogin
  * @param string $sPassword
  * @param string $sProxyAuthUser = ''
  * @param bool $bUseAuthPlainIfSupported = false
  *
  * @return \MailSo\Imap\ImapClient
  *
  * @throws \MailSo\Base\Exceptions\InvalidArgumentException
  * @throws \MailSo\Net\Exceptions\Exception
  * @throws \MailSo\Imap\Exceptions\Exception
  */
 public function Login($sLogin, $sPassword, $sProxyAuthUser = '', $bUseAuthPlainIfSupported = false)
 {
     if (!\MailSo\Base\Validator::NotEmptyString($sLogin, true) || !\MailSo\Base\Validator::NotEmptyString($sPassword, true)) {
         $this->writeLogException(new \MailSo\Base\Exceptions\InvalidArgumentException(), \MailSo\Log\Enumerations\Type::ERROR, true);
     }
     $sLogin = \trim($sLogin);
     $sLogin = \MailSo\Base\Utils::IdnToAscii($sLogin);
     $sPassword = $sPassword;
     $this->sLogginedUser = $sLogin;
     try {
         // TODO
         if (false && $this->IsSupported('AUTH=CRAM-MD5')) {
             $this->SendRequest('AUTHENTICATE', array('CRAM-MD5'));
             $aResponse = $this->parseResponseWithValidation();
             if ($aResponse && \is_array($aResponse) && 0 < \count($aResponse) && \MailSo\Imap\Enumerations\ResponseType::CONTINUATION === $aResponse[\count($aResponse) - 1]->ResponseType) {
                 $oContinuationResponse = null;
                 foreach ($aResponse as $oResponse) {
                     if ($oResponse && \MailSo\Imap\Enumerations\ResponseType::CONTINUATION === $oResponse->ResponseType) {
                         $oContinuationResponse = $oResponse;
                     }
                 }
                 if ($oContinuationResponse) {
                     $sToken = \base64_encode("" . $sLogin . "" . $sPassword);
                     if ($this->oLogger) {
                         $this->oLogger->AddSecret($sToken);
                     }
                     $this->Logger()->WriteDump($aResponse);
                     $this->sendRaw($sToken, true, '*******');
                     $this->parseResponseWithValidation();
                 } else {
                     // TODO
                 }
             }
         } else {
             if ($bUseAuthPlainIfSupported && $this->IsSupported('AUTH=PLAIN')) {
                 $sToken = \base64_encode("" . $sLogin . "" . $sPassword);
                 if ($this->oLogger) {
                     $this->oLogger->AddSecret($sToken);
                 }
                 if ($this->IsSupported('AUTH=SASL-IR') && false) {
                     $this->SendRequestWithCheck('AUTHENTICATE', array('PLAIN', $sToken));
                 } else {
                     $this->SendRequest('AUTHENTICATE', array('PLAIN'));
                     $this->parseResponseWithValidation();
                     $this->sendRaw($sToken, true, '*******');
                     $this->parseResponseWithValidation();
                 }
             } else {
                 if ($this->oLogger) {
                     $this->oLogger->AddSecret($this->EscapeString($sPassword));
                 }
                 $this->SendRequestWithCheck('LOGIN', array($this->EscapeString($sLogin), $this->EscapeString($sPassword)));
             }
         }
         //			else
         //			{
         //				$this->writeLogException(
         //					new \MailSo\Imap\Exceptions\LoginBadMethodException(),
         //					\MailSo\Log\Enumerations\Type::NOTICE, true);
         //			}
         if (0 < \strlen($sProxyAuthUser)) {
             $this->SendRequestWithCheck('PROXYAUTH', array($this->EscapeString($sProxyAuthUser)));
         }
     } catch (\MailSo\Imap\Exceptions\NegativeResponseException $oException) {
         $this->writeLogException(new \MailSo\Imap\Exceptions\LoginBadCredentialsException($oException->GetResponses(), '', 0, $oException), \MailSo\Log\Enumerations\Type::NOTICE, true);
     }
     $this->bIsLoggined = true;
     $this->aCapabilityItems = null;
     return $this;
 }
예제 #20
0
 /**
  * @param string $sTo
  * @param bool $bDsn = false
  *
  * @return \MailSo\Smtp\SmtpClient
  *
  * @throws \MailSo\Net\Exceptions\Exception
  * @throws \MailSo\Smtp\Exceptions\Exception
  */
 public function Rcpt($sTo, $bDsn = false)
 {
     if (!$this->bMail) {
         $this->writeLogException(new Exceptions\RuntimeException('No sender reverse path has been supplied'), \MailSo\Log\Enumerations\Type::ERROR, true);
     }
     $sTo = \MailSo\Base\Utils::IdnToAscii($sTo, true);
     $sCmd = 'TO:<' . $sTo . '>';
     if ($bDsn && $this->IsSupported('DSN')) {
         $sCmd .= ' NOTIFY=SUCCESS,FAILURE';
     }
     $this->sendRequestWithCheck('RCPT', array(250, 251), $sCmd);
     $this->bRcpt = true;
     return $this;
 }