Merge pull request #6315 from nextcloud/metadata-for-all-emails

Implement metadata for email templates of remaining emails
This commit is contained in:
Morris Jobke 2017-08-31 09:54:31 +02:00 committed by GitHub
commit 77354cb7a2
4 changed files with 38 additions and 0 deletions

View File

@ -463,6 +463,13 @@ class ShareByMailProvider implements IShareProvider {
$message = $this->mailer->createMessage(); $message = $this->mailer->createMessage();
$emailTemplate = $this->mailer->createEMailTemplate(); $emailTemplate = $this->mailer->createEMailTemplate();
$emailTemplate->setMetaData('sharebymail.RecipientPasswordNotification', [
'filename' => $filename,
'password' => $password,
'initiator' => $initiatorDisplayName,
'initiatorEmail' => $initiatorEmailAddress,
'shareWith' => $shareWith,
]);
$emailTemplate->addHeader(); $emailTemplate->addHeader();
$emailTemplate->addHeading($this->l->t('Password to access »%s«', [$filename]), false); $emailTemplate->addHeading($this->l->t('Password to access »%s«', [$filename]), false);
$emailTemplate->addBodyText($htmlBodyPart, $plainBodyPart); $emailTemplate->addBodyText($htmlBodyPart, $plainBodyPart);
@ -524,6 +531,13 @@ class ShareByMailProvider implements IShareProvider {
$message = $this->mailer->createMessage(); $message = $this->mailer->createMessage();
$emailTemplate = $this->mailer->createEMailTemplate(); $emailTemplate = $this->mailer->createEMailTemplate();
$emailTemplate->setMetaData('sharebymail.OwnerPasswordNotification', [
'filename' => $filename,
'password' => $password,
'initiator' => $initiatorDisplayName,
'initiatorEmail' => $initiatorEMailAddress,
'shareWith' => $shareWith,
]);
$emailTemplate->addHeader(); $emailTemplate->addHeader();
$emailTemplate->addHeading($this->l->t('Password to access »%s«', [$filename]), false); $emailTemplate->addHeading($this->l->t('Password to access »%s«', [$filename]), false);

View File

@ -148,6 +148,11 @@ class MailSettingsController extends Controller {
$displayName = $this->userSession->getUser()->getDisplayName(); $displayName = $this->userSession->getUser()->getDisplayName();
$template = $this->mailer->createEMailTemplate(); $template = $this->mailer->createEMailTemplate();
$template->setMetaData('settings.TestEmail', [
'displayname' => $displayName,
]);
$template->addHeader(); $template->addHeader();
$template->addHeading($this->l10n->t('Well done, %s!', [$displayName])); $template->addHeading($this->l10n->t('Well done, %s!', [$displayName]));
$template->addBodyText($this->l10n->t('If you received this email, the email configuration seems to be correct.')); $template->addBodyText($this->l10n->t('If you received this email, the email configuration seems to be correct.'));

View File

@ -118,6 +118,11 @@ class Hooks {
if ($user->getEMailAddress() !== null) { if ($user->getEMailAddress() !== null) {
$template = $this->mailer->createEMailTemplate(); $template = $this->mailer->createEMailTemplate();
$template->setMetaData('settings.PasswordChanged', [
'displayname' => $user->getDisplayName(),
'emailAddress' => $user->getEMailAddress(),
'instanceUrl' => $instanceUrl,
]);
$template->addHeader(); $template->addHeader();
$template->addHeading($this->l->t('Password changed for %s', [$user->getDisplayName()]), false); $template->addHeading($this->l->t('Password changed for %s', [$user->getDisplayName()]), false);
$template->addBodyText($text . ' ' . $this->l->t('If you did not request this, please contact an administrator.')); $template->addBodyText($text . ' ' . $this->l->t('If you did not request this, please contact an administrator.'));
@ -184,6 +189,12 @@ class Hooks {
if ($oldMailAddress !== null) { if ($oldMailAddress !== null) {
$template = $this->mailer->createEMailTemplate(); $template = $this->mailer->createEMailTemplate();
$template->setMetaData('settings.EmailChanged', [
'displayname' => $user->getDisplayName(),
'newEMailAddress' => $user->getEMailAddress(),
'oldEMailAddress' => $oldMailAddress,
'instanceUrl' => $instanceUrl,
]);
$template->addHeader(); $template->addHeader();
$template->addHeading($this->l->t('Email address changed for %s', [$user->getDisplayName()]), false); $template->addHeading($this->l->t('Email address changed for %s', [$user->getDisplayName()]), false);
$template->addBodyText($text . ' ' . $this->l->t('If you did not request this, please contact an administrator.')); $template->addBodyText($text . ' ' . $this->l->t('If you did not request this, please contact an administrator.'));

View File

@ -139,6 +139,14 @@ class NewUserMailHelper {
); );
$emailTemplate->addFooter(); $emailTemplate->addFooter();
$emailTemplate->setMetaData('settings.Welcome', [
'link' => $link,
'displayname' => $displayName,
'username' => $userName,
'instancename' => $this->themingDefaults->getName(),
'resetTokenGenerated' => $generatePasswordResetToken,
]);
return $emailTemplate; return $emailTemplate;
} }