diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-04-11 17:32:48 -0500 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2017-04-11 17:32:48 -0500 |
commit | 8fa5141aaa346fc21198ad59c315eb99a8b8e48a (patch) | |
tree | b88273d191e11f9541609f08935c2956c85346aa /lib/private/Share | |
parent | 6bd1c50dc32ccc208723ef08af72b8bfe99b58bb (diff) | |
download | nextcloud-server-8fa5141aaa346fc21198ad59c315eb99a8b8e48a.tar.gz nextcloud-server-8fa5141aaa346fc21198ad59c315eb99a8b8e48a.zip |
Removes unused code for link share emails
* now handled by sharebymail app
* see https://github.com/nextcloud/server/pull/657
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'lib/private/Share')
-rw-r--r-- | lib/private/Share/MailNotifications.php | 68 |
1 files changed, 0 insertions, 68 deletions
diff --git a/lib/private/Share/MailNotifications.php b/lib/private/Share/MailNotifications.php index 1ea053fc499..e10389e77b9 100644 --- a/lib/private/Share/MailNotifications.php +++ b/lib/private/Share/MailNotifications.php @@ -86,72 +86,4 @@ class MailNotifications { $this->replyTo = $this->user->getEMailAddress(); $this->senderDisplayName = $this->user->getDisplayName(); } - - /** - * inform recipient about public link share - * - * @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 string[] $result of failed recipients - */ - public function sendLinkShareMail($recipient, $filename, $link, $expiration) { - $subject = (string)$this->l->t('%s shared »%s« with you', [$this->senderDisplayName, $filename]); - list($htmlBody, $textBody) = $this->createMailBody($filename, $link, $expiration); - - $recipient = str_replace([', ', '; ', ',', ';', ' '], ',', $recipient); - $recipients = explode(',', $recipient); - try { - $message = $this->mailer->createMessage(); - $message->setSubject($subject); - $message->setTo($recipients); - $message->setHtmlBody($htmlBody); - $message->setPlainBody($textBody); - $message->setFrom([ - Util::getDefaultEmailAddress('sharing-noreply') => - (string)$this->l->t('%s via %s', [ - $this->senderDisplayName, - $this->defaults->getName() - ]), - ]); - if(!is_null($this->replyTo)) { - $message->setReplyTo([$this->replyTo]); - } - - return $this->mailer->send($message); - } catch (\Exception $e) { - $this->logger->error("Can't send mail with public link to $recipient: ".$e->getMessage(), ['app' => 'sharing']); - return [$recipient]; - } - } - - /** - * create mail body for plain text and html mail - * - * @param string $filename the shared file - * @param string $link link to the shared file - * @param int $expiration expiration date (timestamp) - * @param string $prefix prefix of mail template files - * @return array an array of the html mail body and the plain text mail body - */ - private function createMailBody($filename, $link, $expiration, $prefix = '') { - $formattedDate = $expiration ? $this->l->l('date', $expiration) : null; - - $html = new \OC_Template('core', $prefix . 'mail', ''); - $html->assign ('link', $link); - $html->assign ('user_displayname', $this->senderDisplayName); - $html->assign ('filename', $filename); - $html->assign('expiration', $formattedDate); - $htmlMail = $html->fetchPage(); - - $plainText = new \OC_Template('core', $prefix . 'altmail', ''); - $plainText->assign ('link', $link); - $plainText->assign ('user_displayname', $this->senderDisplayName); - $plainText->assign ('filename', $filename); - $plainText->assign('expiration', $formattedDate); - $plainTextMail = $plainText->fetchPage(); - - return [$htmlMail, $plainTextMail]; - } } |