Skip to content
Snippets Groups Projects
Commit 66da0a21 authored by Michael Gapczynski's avatar Michael Gapczynski
Browse files

Catch exceptions from PHPMailer

parent 7077678f
Branches
No related tags found
No related merge requests found
......@@ -56,33 +56,35 @@ class OC_Mail {
$mailo->From =$fromaddress;
$mailo->FromName = $fromname;;
$a=explode(' ',$toaddress);
foreach($a as $ad) {
$mailo->AddAddress($ad,$toname);
try {
foreach($a as $ad) {
$mailo->AddAddress($ad,$toname);
}
if($ccaddress<>'') $mailo->AddCC($ccaddress,$ccname);
if($bcc<>'') $mailo->AddBCC($bcc);
$mailo->AddReplyTo($fromaddress, $fromname);
$mailo->WordWrap = 50;
if($html==1) $mailo->IsHTML(true); else $mailo->IsHTML(false);
$mailo->Subject = $subject;
if($altbody=='') {
$mailo->Body = $mailtext.OC_MAIL::getfooter();
$mailo->AltBody = '';
}else{
$mailo->Body = $mailtext;
$mailo->AltBody = $altbody;
}
$mailo->CharSet = 'UTF-8';
$mailo->Send();
unset($mailo);
OC_Log::write('Mail from '.$fromname.' ('.$fromaddress.')'.' to: '.$toname.'('.$toaddress.')'.' subject: '.$subject,'mail',OC_Log::DEBUG);
} catch (Exception $exception) {
OC_Log::write('mail', $exception->getMessage(), OC_Log::DEBUG);
}
if($ccaddress<>'') $mailo->AddCC($ccaddress,$ccname);
if($bcc<>'') $mailo->AddBCC($bcc);
$mailo->AddReplyTo($fromaddress, $fromname);
$mailo->WordWrap = 50;
if($html==1) $mailo->IsHTML(true); else $mailo->IsHTML(false);
$mailo->Subject = $subject;
if($altbody=='') {
$mailo->Body = $mailtext.OC_MAIL::getfooter();
$mailo->AltBody = '';
}else{
$mailo->Body = $mailtext;
$mailo->AltBody = $altbody;
}
$mailo->CharSet = 'UTF-8';
$mailo->Send();
unset($mailo);
OC_Log::write('Mail from '.$fromname.' ('.$fromaddress.')'.' to: '.$toname.'('.$toaddress.')'.' subject: '.$subject,'mail',OC_Log::DEBUG);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment