mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-09 09:27:03 +03:00
Throw more errors when using PHP mail()
This commit is contained in:
parent
35db1f4eb8
commit
7213395118
1 changed files with 30 additions and 30 deletions
|
|
@ -777,11 +777,17 @@ trait Messages
|
|||
$oAccount->SmtpConnectAndLogin($this->Plugins(), $oSmtpClient);
|
||||
|
||||
if ($oSmtpClient->Settings->usePhpMail) {
|
||||
if (\MailSo\Base\Utils::FunctionCallable('mail')) {
|
||||
if (!$sFrom || !\MailSo\Base\Utils::FunctionCallable('mail')) {
|
||||
throw new ClientException(Notifications::CantSendMessage);
|
||||
}
|
||||
$oToCollection = $oMessage->GetTo();
|
||||
if ($oToCollection && $oFrom) {
|
||||
if (!$oToCollection) {
|
||||
throw new ClientException(Notifications::CantSendMessage);
|
||||
}
|
||||
$sRawBody = \stream_get_contents($rMessageStream);
|
||||
if (!empty($sRawBody)) {
|
||||
if (empty($sRawBody)) {
|
||||
throw new ClientException(Notifications::CantSendMessage);
|
||||
}
|
||||
$sMailTo = \trim($oToCollection->ToString(true));
|
||||
$sMailSubject = \trim($oMessage->GetSubject());
|
||||
$sMailSubject = \strlen($sMailSubject) ? \MailSo\Base\Utils::EncodeHeaderValue($sMailSubject) : '';
|
||||
|
|
@ -802,17 +808,11 @@ trait Messages
|
|||
), \LOG_DEBUG);
|
||||
|
||||
$bR = $this->Config()->Get('labs', 'mail_func_additional_parameters', false) ?
|
||||
\mail($sMailTo, $sMailSubject, $sMailBody, $sMailHeaders, '-f'.$oFrom->GetEmail()) :
|
||||
\mail($sMailTo, $sMailSubject, $sMailBody, $sMailHeaders, '-f'.$sFrom) :
|
||||
\mail($sMailTo, $sMailSubject, $sMailBody, $sMailHeaders);
|
||||
|
||||
if (!$bR) {
|
||||
throw new ClientException(Notifications::CantSendMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw new ClientException(Notifications::CantSendMessage);
|
||||
}
|
||||
} else if ($oSmtpClient->IsConnected()) {
|
||||
if ($iMessageStreamSize && $oSmtpClient->maxSize() && $iMessageStreamSize * 1.33 > $oSmtpClient->maxSize()) {
|
||||
throw new ClientException(Notifications::ClientViewError, 'Message size '. ($iMessageStreamSize * 1.33) . ' bigger then max ' . $oSmtpClient->maxSize());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue