Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2012-07-11 23:36:27 +0400
committerMichael Gapczynski <mtgap@owncloud.com>2012-07-11 23:36:27 +0400
commit66da0a215137ef03b31a6b5706007e503aa1ad0a (patch)
treec1d29034f384081c6639c7efa3e7d515087654d3 /lib/mail.php
parent7077678f7fb33b376e05eece3b62dc4ae058055a (diff)
Catch exceptions from PHPMailer
Diffstat (limited to 'lib/mail.php')
-rw-r--r--lib/mail.php54
1 files changed, 28 insertions, 26 deletions
diff --git a/lib/mail.php b/lib/mail.php
index 7343f5f0d97..9d2cd62494b 100644
--- a/lib/mail.php
+++ b/lib/mail.php
@@ -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);
-
}