diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-03-10 21:54:23 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-03-10 21:54:23 +0100 |
commit | f1ecc758f5f6543566ae9970de837e5524cf8bf9 (patch) | |
tree | 33383c7105101a6429427a6134e7e90a2ab4c2e8 /lib/private/share/mailnotifications.php | |
parent | 1cde17d60b0f6aec8e50e31f5db8c76c92f8d1e3 (diff) | |
download | nextcloud-server-f1ecc758f5f6543566ae9970de837e5524cf8bf9.tar.gz nextcloud-server-f1ecc758f5f6543566ae9970de837e5524cf8bf9.zip |
send an individual email to each recipient
Diffstat (limited to 'lib/private/share/mailnotifications.php')
-rw-r--r-- | lib/private/share/mailnotifications.php | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/lib/private/share/mailnotifications.php b/lib/private/share/mailnotifications.php index 360376294cc..45734818731 100644 --- a/lib/private/share/mailnotifications.php +++ b/lib/private/share/mailnotifications.php @@ -97,7 +97,7 @@ class MailNotifications { try { \OCP\Util::sendMail($to, $recipientDisplayName, $subject, $htmlMail, $this->from, $this->senderDisplayName, 1, $alttextMail); } catch (\Exception $e) { - \OCP\Util::writeLog('sharing', "Can't send mail to inform the user abaut an internal share: " . $e->getMessage() , \OCP\Util::ERROR); + \OCP\Util::writeLog('sharing', "Can't send mail to inform the user about an internal share: " . $e->getMessage() , \OCP\Util::ERROR); $noMail[] = $recipientDisplayName; } } @@ -109,23 +109,26 @@ class MailNotifications { /** * @brief inform recipient about public link share * - * @param string recipient recipient email address + * @param string $recipient recipient email address * @param string $filename the shared file * @param string $link the public link * @param int $expiration expiration date (timestamp) - * @return mixed $result true or error message + * @return array $result of failed recipients */ public function sendLinkShareMail($recipient, $filename, $link, $expiration) { $subject = (string)$this->l->t('%s shared »%s« with you', array($this->senderDisplayName, $filename)); list($htmlMail, $alttextMail) = $this->createMailBody($filename, $link, $expiration); - try { - \OCP\Util::sendMail($recipient, $recipient, $subject, $htmlMail, $this->from, $this->senderDisplayName, 1, $alttextMail); - } catch (\Exception $e) { - \OCP\Util::writeLog('sharing', "Can't send mail with public link: " . $e->getMessage(), \OCP\Util::ERROR); - return $e->getMessage(); + $rs = explode(' ', $recipient); + $failed = array(); + foreach ($rs as $r) { + try { + \OCP\Util::sendMail($r, $r, $subject, $htmlMail, $this->from, $this->senderDisplayName, 1, $alttextMail); + } catch (\Exception $e) { + \OCP\Util::writeLog('sharing', "Can't send mail with public link to $r: " . $e->getMessage(), \OCP\Util::ERROR); + $failed[] = $r; + } } - - return true; + return $failed; } /** |