mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
* API/eMail: catching failure to attach files, or fail on attaching empty files, or failure to encode files
This commit is contained in:
parent
fb7baf49c1
commit
1f6c3b2df7
@ -625,6 +625,9 @@ class PHPMailer {
|
|||||||
if (empty($this->Body)) {
|
if (empty($this->Body)) {
|
||||||
throw new phpmailerException($this->Lang('empty_message'), self::STOP_CRITICAL);
|
throw new phpmailerException($this->Lang('empty_message'), self::STOP_CRITICAL);
|
||||||
}
|
}
|
||||||
|
if ($this->IsError()) {
|
||||||
|
throw new phpmailerException($this->ErrorInfo, self::STOP_CRITICAL);
|
||||||
|
}
|
||||||
|
|
||||||
// digitally sign with DKIM if enabled
|
// digitally sign with DKIM if enabled
|
||||||
if ($this->DKIM_domain && $this->DKIM_private) {
|
if ($this->DKIM_domain && $this->DKIM_private) {
|
||||||
@ -1544,6 +1547,7 @@ class PHPMailer {
|
|||||||
} else {
|
} else {
|
||||||
$mime[] = $this->EncodeFile($path, $encoding);
|
$mime[] = $this->EncodeFile($path, $encoding);
|
||||||
if($this->IsError()) {
|
if($this->IsError()) {
|
||||||
|
$this->SetError(__METHOD__.'->'.'cowardly refuse to attach empty or missing file:'.($name?$name:$filename) );
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
$mime[] = $this->LE.$this->LE;
|
$mime[] = $this->LE.$this->LE;
|
||||||
@ -1580,9 +1584,21 @@ class PHPMailer {
|
|||||||
try {
|
try {
|
||||||
if ((@$file_buffer = file_get_contents($path))===false)
|
if ((@$file_buffer = file_get_contents($path))===false)
|
||||||
{
|
{
|
||||||
throw new phpmailerException($this->Lang('file_open') . $path, self::STOP_CONTINUE);
|
//throw new phpmailerException($this->Lang('file_open') . $path, self::STOP_CONTINUE);
|
||||||
|
$this->SetError($this->Lang('file_open') . $path);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (strlen(trim($file_buffer))==0) // do the complaining one level up, where we may have the name of the file
|
||||||
|
{
|
||||||
|
$this->SetError($this->Lang('file_open') . $path. ':'.'is empty');
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
$file_buffer = $this->EncodeString($file_buffer, $encoding);
|
$file_buffer = $this->EncodeString($file_buffer, $encoding);
|
||||||
|
if (strlen(trim($file_buffer))==0) // do the complaining one level up, where we may have the name of the file
|
||||||
|
{
|
||||||
|
$this->SetError($this->Lang('file_open') . $path. ':'."is empty after encoding to $encoding");
|
||||||
|
return "";
|
||||||
|
}
|
||||||
if (PHP_VERSION < 6)
|
if (PHP_VERSION < 6)
|
||||||
{
|
{
|
||||||
if ($magic_quotes) set_magic_quotes_runtime($magic_quotes);
|
if ($magic_quotes) set_magic_quotes_runtime($magic_quotes);
|
||||||
@ -2080,7 +2096,7 @@ class PHPMailer {
|
|||||||
$msg .= '<p>' . $this->Lang('smtp_error') . $lasterror['smtp_msg'] . "</p>\n";
|
$msg .= '<p>' . $this->Lang('smtp_error') . $lasterror['smtp_msg'] . "</p>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->ErrorInfo .= (empty($this->ErrorInfo)?'':'<br>').$msg;
|
if (empty($this->ErrorInfo) || strpos($this->ErrorInfo,$msg)===false) $this->ErrorInfo .= (empty($this->ErrorInfo)?'':'<br>').$msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user