summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Christoph Borchardt <hey@jancborchardt.net>2013-06-14 14:43:41 -0700
committerJan-Christoph Borchardt <hey@jancborchardt.net>2013-06-14 14:43:41 -0700
commit9dfba295cda97764205952e05eb28197f56bae15 (patch)
tree11a68b09a6ecd4cdc0a6e0b38affb446556f9c98
parent126a0cac8db2160b511965c9640f769238f8ef3a (diff)
parentf3d33a7d5bd98c9c0da62097e643e95f0b4b923d (diff)
downloadnextcloud-server-9dfba295cda97764205952e05eb28197f56bae15.tar.gz
nextcloud-server-9dfba295cda97764205952e05eb28197f56bae15.zip
Merge pull request #3733 from owncloud/email_template
E-mail templates (#3683)
-rw-r--r--core/ajax/share.php23
-rw-r--r--core/img/logo-mail.gifbin0 -> 2196 bytes
-rw-r--r--core/templates/altmail.php9
-rw-r--r--core/templates/mail.php33
4 files changed, 56 insertions, 9 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php
index 5854b65aa03..bdcb61284ec 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -94,23 +94,28 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
$l = OC_L10N::get('core');
// setup the email
- $subject = (string)$l->t('User %s shared a file with you', $displayName);
- if ($type === 'folder')
- $subject = (string)$l->t('User %s shared a folder with you', $displayName);
+ $subject = (string)$l->t('%s shared »%s« with you', array($displayName, $file));
- $text = (string)$l->t('User %s shared the file "%s" with you. It is available for download here: %s',
- array($displayName, $file, $link));
- if ($type === 'folder')
- $text = (string)$l->t('User %s shared the folder "%s" with you. It is available for download here: %s',
- array($displayName, $file, $link));
+ $content = new OC_Template("core", "mail", "");
+ $content->assign ('link', $link);
+ $content->assign ('type', $type);
+ $content->assign ('user_displayname', $displayName);
+ $content->assign ('filename', $file);
+ $text = $content->fetchPage();
+ $content = new OC_Template("core", "altmail", "");
+ $content->assign ('link', $link);
+ $content->assign ('type', $type);
+ $content->assign ('user_displayname', $displayName);
+ $content->assign ('filename', $file);
+ $alttext = $content->fetchPage();
$default_from = OCP\Util::getDefaultEmailAddress('sharing-noreply');
$from_address = OCP\Config::getUserValue($user, 'settings', 'email', $default_from );
// send it out now
try {
- OCP\Util::sendMail($to_address, $to_address, $subject, $text, $from_address, $displayName);
+ OCP\Util::sendMail($to_address, $to_address, $subject, $text, $from_address, $displayName, 1, $alttext);
OCP\JSON::success();
} catch (Exception $exception) {
OCP\JSON::error(array('data' => array('message' => OC_Util::sanitizeHTML($exception->getMessage()))));
diff --git a/core/img/logo-mail.gif b/core/img/logo-mail.gif
new file mode 100644
index 00000000000..6a1caaa9188
--- /dev/null
+++ b/core/img/logo-mail.gif
Binary files differ
diff --git a/core/templates/altmail.php b/core/templates/altmail.php
new file mode 100644
index 00000000000..37dc8eee942
--- /dev/null
+++ b/core/templates/altmail.php
@@ -0,0 +1,9 @@
+<?php
+print_unescaped($l->t("Hey there,\n\njust letting you know that %s shared %s with you.\nView it: %s\n\nCheers!", array($_['user_displayname'], $_['filename'], $_['link'])));
+?>
+
+--
+ownCloud - <?php
+print_unescaped($l->t("web services under your control"));
+?>
+http://ownCloud.org
diff --git a/core/templates/mail.php b/core/templates/mail.php
new file mode 100644
index 00000000000..ebeefd5c7e8
--- /dev/null
+++ b/core/templates/mail.php
@@ -0,0 +1,33 @@
+<table cellspacing="0" cellpadding="0" border="0" width="100%">
+<tr><td>
+<table cellspacing="0" cellpadding="0" border="0" width="600px">
+<tr>
+<td bgcolor="#1d2d44" width="20px">&nbsp;</td>
+<td bgcolor="#1d2d44">
+<img src="<?php print_unescaped(OC_Helper::makeURLAbsolute(image_path('', 'logo-mail.gif'))); ?>" alt="ownCloud"/>
+</td>
+</tr>
+<tr><td bgcolor="#f8f8f8" colspan="2">&nbsp;</td></tr>
+<tr>
+<td bgcolor="#f8f8f8" width="20px">&nbsp;</td>
+<td bgcolor="#f8f8f8" style="font-weight:normal; font-size:0.8em; line-height:1.2em; font-family:verdana,'arial',sans;">
+<?php
+print_unescaped($l->t('Hey there,<br><br>just letting you know that %s shared »%s« with you.<br><a href="%s">View it!</a><br><br>Cheers!', array($_['user_displayname'], $_['filename'], $_['link'])));
+?>
+</td>
+</tr>
+<tr><td bgcolor="#f8f8f8" colspan="2">&nbsp;</td></tr>
+<tr>
+<td bgcolor="#f8f8f8" width="20px">&nbsp;</td>
+<td bgcolor="#f8f8f8" style="font-weight:normal; font-size:0.8em; line-height:1.2em; font-family:verdana,'arial',sans;">--<br>
+ownCloud - <?php
+print_unescaped($l->t('web services under your control'));
+?>
+<br><a href="http://owncloud.org">http://ownCloud.org</a></td>
+</tr>
+<tr>
+<td bgcolor="#f8f8f8" colspan="2">&nbsp;</td>
+</tr>
+</table>
+</td></tr>
+</table>