mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
Code refactoring
This commit is contained in:
parent
bf56821c2d
commit
31860420cb
32 changed files with 1342 additions and 1282 deletions
|
|
@ -306,13 +306,14 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
/**
|
||||
* @param string $sFrom
|
||||
* @param string $sSizeIfSupported = ''
|
||||
* @param bool $bDsn = false
|
||||
*
|
||||
* @return \MailSo\Smtp\SmtpClient
|
||||
*
|
||||
* @throws \MailSo\Net\Exceptions\Exception
|
||||
* @throws \MailSo\Smtp\Exceptions\Exception
|
||||
*/
|
||||
public function MailFrom($sFrom, $sSizeIfSupported = '')
|
||||
public function MailFrom($sFrom, $sSizeIfSupported = '', $bDsn = false)
|
||||
{
|
||||
$sFrom = \MailSo\Base\Utils::IdnToAscii($sFrom, true);
|
||||
$sCmd = 'FROM:<'.$sFrom.'>';
|
||||
|
|
@ -323,6 +324,11 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
$sCmd .= ' SIZE='.$sSizeIfSupported;
|
||||
}
|
||||
|
||||
if ($bDsn && $this->IsSupported('DSN'))
|
||||
{
|
||||
$sCmd .= ' RET=HDRS';
|
||||
}
|
||||
|
||||
$this->sendRequestWithCheck('MAIL', 250, $sCmd);
|
||||
|
||||
$this->bMail = true;
|
||||
|
|
@ -334,13 +340,14 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
|
||||
/**
|
||||
* @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)
|
||||
public function Rcpt($sTo, $bDsn = false)
|
||||
{
|
||||
if (!$this->bMail)
|
||||
{
|
||||
|
|
@ -350,7 +357,14 @@ class SmtpClient extends \MailSo\Net\NetClient
|
|||
}
|
||||
|
||||
$sTo = \MailSo\Base\Utils::IdnToAscii($sTo, true);
|
||||
$this->sendRequestWithCheck('RCPT', array(250, 251), 'TO:<'.$sTo.'>');
|
||||
$sCmd = 'TO:<'.$sTo.'>';
|
||||
|
||||
if ($bDsn && $this->IsSupported('DSN'))
|
||||
{
|
||||
$sCmd .= ' NOTIFY=SUCCESS,FAILURE';
|
||||
}
|
||||
|
||||
$this->sendRequestWithCheck('RCPT', array(250, 251), $sCmd);
|
||||
|
||||
$this->bRcpt = true;
|
||||
|
||||
|
|
|
|||
|
|
@ -5752,12 +5752,14 @@ class Actions
|
|||
* @param \RainLoop\Model\Account $oAccount
|
||||
* @param \MailSo\Mime\Message $oMessage
|
||||
* @param resource $rMessageStream
|
||||
* @param bool $bDsn = true
|
||||
* @param bool $bAddHiddenRcpt = true
|
||||
*
|
||||
* @throws \RainLoop\Exceptions\ClientException
|
||||
* @throws \MailSo\Net\Exceptions\ConnectionException
|
||||
*/
|
||||
private function smtpSendMessage($oAccount, $oMessage, &$rMessageStream, &$iMessageStreamSize, $bAddHiddenRcpt = true)
|
||||
private function smtpSendMessage($oAccount, $oMessage,
|
||||
&$rMessageStream, &$iMessageStreamSize, $bDsn = false, $bAddHiddenRcpt = true)
|
||||
{
|
||||
$oRcpt = $oMessage->GetRcpt();
|
||||
if ($oRcpt && 0 < $oRcpt->Count())
|
||||
|
|
@ -5773,9 +5775,9 @@ class Actions
|
|||
$sFrom = $oFrom instanceof \MailSo\Mime\Email ? $oFrom->GetEmail() : '';
|
||||
$sFrom = empty($sFrom) ? $oAccount->Email() : $sFrom;
|
||||
|
||||
$aHiddenRcpt = array();
|
||||
$this->Plugins()->RunHook('filter.smtp-from', array($oAccount, $oMessage, &$sFrom));
|
||||
|
||||
$aHiddenRcpt = array();
|
||||
if ($bAddHiddenRcpt)
|
||||
{
|
||||
$this->Plugins()->RunHook('filter.smtp-hidden-rcpt', array($oAccount, $oMessage, &$aHiddenRcpt));
|
||||
|
|
@ -5806,9 +5808,9 @@ class Actions
|
|||
list($sMailHeaders, $sMailBody) = \explode("\r\n\r\n", $sRawBody, 2);
|
||||
unset($sRawBody);
|
||||
|
||||
$this->Logger()->WriteDump(array(
|
||||
$sMailTo, $sMailSubject, $sMailBody, $sMailHeaders
|
||||
));
|
||||
// $this->Logger()->WriteDump(array(
|
||||
// $sMailTo, $sMailSubject, $sMailBody, $sMailHeaders
|
||||
// ));
|
||||
|
||||
if (!\mail($sMailTo, $sMailSubject, $sMailBody, $sMailHeaders/*, '-f'.$oFrom->GetEmail()*/))
|
||||
{
|
||||
|
|
@ -5824,15 +5826,17 @@ class Actions
|
|||
}
|
||||
else if ($oSmtpClient->IsConnected())
|
||||
{
|
||||
$bDsn = false;
|
||||
|
||||
if (!empty($sFrom))
|
||||
{
|
||||
$oSmtpClient->MailFrom($sFrom);
|
||||
$oSmtpClient->MailFrom($sFrom, '', $bDsn);
|
||||
}
|
||||
|
||||
$aRcpt =& $oRcpt->GetAsArray();
|
||||
foreach ($aRcpt as /* @var $oEmail \MailSo\Mime\Email */ $oEmail)
|
||||
{
|
||||
$oSmtpClient->Rcpt($oEmail->GetEmail());
|
||||
$oSmtpClient->Rcpt($oEmail->GetEmail(), $bDsn);
|
||||
}
|
||||
|
||||
if ($bAddHiddenRcpt && \is_array($aHiddenRcpt) && 0 < \count($aHiddenRcpt))
|
||||
|
|
@ -5902,6 +5906,7 @@ class Actions
|
|||
$sDraftUid = $this->GetActionParam('MessageUid', '');
|
||||
$sSentFolder = $this->GetActionParam('SentFolder', '');
|
||||
$aDraftInfo = $this->GetActionParam('DraftInfo', null);
|
||||
$bDsn = '1' === $this->GetActionParam('Dsn', '0');
|
||||
|
||||
$oMessage = $this->buildMessage($oAccount, false);
|
||||
|
||||
|
|
@ -5922,7 +5927,7 @@ class Actions
|
|||
|
||||
if (false !== $iMessageStreamSize)
|
||||
{
|
||||
$this->smtpSendMessage($oAccount, $oMessage, $rMessageStream, $iMessageStreamSize);
|
||||
$this->smtpSendMessage($oAccount, $oMessage, $rMessageStream, $iMessageStreamSize, $bDsn, true);
|
||||
|
||||
$this->deleteMessageAttachmnets($oAccount);
|
||||
|
||||
|
|
@ -6096,7 +6101,7 @@ class Actions
|
|||
|
||||
if (false !== $iMessageStreamSize)
|
||||
{
|
||||
$this->smtpSendMessage($oAccount, $oMessage, $rMessageStream, $iMessageStreamSize);
|
||||
$this->smtpSendMessage($oAccount, $oMessage, $rMessageStream, $iMessageStreamSize, false, false);
|
||||
|
||||
if (\is_resource($rMessageStream))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="attachmentAreaParent b-content" style="height: 200px; min-height: 200px" data-bind="nano: true, visible: attachmentsPlace, initResizeTrigger: [resizer(), 200, 47]">
|
||||
<div class="attachmentAreaParent b-content" style="height: 200px; min-height: 200px" data-bind="nano: true, visible: attachmentsPlace, initResizeTrigger: [resizer(), 200, 57]">
|
||||
<div class="content g-scrollbox">
|
||||
<div class="content-wrapper">
|
||||
<ul class="attachmentList" data-bind="template: { name: 'ComposeAttachment', foreach: attachments }"></ul>
|
||||
|
|
@ -204,7 +204,7 @@
|
|||
</div>
|
||||
|
||||
<div class="textAreaParent" style="height: 200px; min-height: 200px"
|
||||
data-bind="visible: !attachmentsPlace(), initDom: composeEditorArea, initResizeTrigger: [resizer(), 200, 30]"></div>
|
||||
data-bind="visible: !attachmentsPlace(), initDom: composeEditorArea, initResizeTrigger: [resizer(), 200, 40]"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="row" data-bind="visible: inited() && !serverError()">
|
||||
<div class="span4">
|
||||
<div class="span5">
|
||||
<a class="btn" data-bind="click: addFilter">
|
||||
<i class="icon-plus"></i>
|
||||
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
<span class="i18n" data-i18n-text="SETTINGS_FILTERS/BUTTON_SAVE"></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="span4" style="margin-left: 0;">
|
||||
<div class="span3" style="margin-left: 0;">
|
||||
<span data-bind="text: saveErrorText"style="color:red"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue