Manual:Extension/Notifications/Email layout: Difference between revisions

No edit summary
Tag: 2017 source edit
No edit summary
 
(One intermediate revision by the same user not shown)
Line 11: Line 11:


=== MediaWiki:Wrapper.mail ===
=== MediaWiki:Wrapper.mail ===
The mail wrapper contains the overall styling of the email. Here, you can set the logo that is used in the email body. By default, the emails display the logo that is defined in[[Manual:Extension/FlexiSkin|FlexiSkin]].  
The mail wrapper contains the overall styling of the email. Here, you can set the logo that is used in the email body. By default, the emails display the logo that is defined in [[Manual:Extension/FlexiSkin|FlexiSkin]].  


The wiki shows a preview of the current email layout. You can edit this page in source editing mode. The layout is generated by a combination of html container elements that wrap around the parameter "Content".  Like with every wiki page, you create a version history of your changes and it is easy to revert to the original layout if needed.  
The wiki shows a preview of the current email layout. You can edit this page in source editing mode. The layout is generated by a combination of html container elements that wrap around the parameter "Content".  Like with every wiki page, you create a version history of your changes and it is easy to revert to the original layout if needed.  
Line 38: Line 38:




You could also embed this new content as a[[mediawikiwiki:Help:System_message|system message]] if you know how system messages work. This would ensure that users see this text in the language that they defined in their preferences.
You could also embed this new content as a [[mediawikiwiki:Help:System_message|system message]] if you know how system messages work. This would ensure that users see this text in the language that they defined in their preferences.


After saving the changes, you see the updated template. Please note that clicking on this email link will cause a security error in the wiki, but not in the actual email that is sent.
After saving the changes, you see the updated template. Please note that clicking on this email link will cause a security error in the wiki, but not in the actual email that is sent.

Latest revision as of 17:17, 11 July 2024

Starting with BlueSpice 4.5, you can customize the email templates for notifications directly in the wiki.

Customizing the notification emails

Three templates are used for the emails:

  • MediaWiki:Wrapper.mail: As the name says, this template wraps the actual email text. Here, you can change the logo.
  • MediaWiki:SingleNotification.mail: Content for the instant notifications.
  • MediaWiki:DigestNotification.mail: Content for the daily or weekly digest notifications.
Template output with outside wrapper and inside content template
Notification mail template

Since the customizations need to be done in source editing mode, an understanding of wikitext, html and css is required.

MediaWiki:Wrapper.mail

The mail wrapper contains the overall styling of the email. Here, you can set the logo that is used in the email body. By default, the emails display the logo that is defined in FlexiSkin.

The wiki shows a preview of the current email layout. You can edit this page in source editing mode. The layout is generated by a combination of html container elements that wrap around the parameter "Content". Like with every wiki page, you create a version history of your changes and it is easy to revert to the original layout if needed.

The HTML "head"-tag defines some meta information and does not need to be changed.

In the "body"-tag, the background color and content padding is set. If you do not use FlexiSkin or have a custom template defined on the server, the background is white.

The first div-container wraps around the logo. It contains some styles that are predefined in the wiki's skin, but could be overwritten. Since the text color is usually black or a dark grey, we can usually leave all the custom settings as is.

To use a logo that you have uploaded to the wiki, you can add its path as the image source. For example:

	<img src="/w/nsfr_img_auth.php/c/c9/mycompany-logo.jpeg" width="150px" alt="MyCompany logo"/>

When you edit this page, make sure not to remove the content placeholder. This placeholder is required to add the actual email text from single or the digest notification email template and looks like this:

{{{content}}}

Let's switch to the content templates.

MediaWiki:SingleNotification.mail

The single notification template sends out an email immediately after a triggering event. Since this template is used for all kinds of notifications, you shoul leave the default content alone in most cases. But you can add additional content for example.

Here, I add the contact and email information of the wiki administrator in case there are questions about the notification emails right between the two HTML "div"-containers. This places the new content above the grey footer box:

{{{content}}}
Source view of the singleNotification template with added custom text.
SingleNotification custom text


You could also embed this new content as a system message if you know how system messages work. This would ensure that users see this text in the language that they defined in their preferences.

After saving the changes, you see the updated template. Please note that clicking on this email link will cause a security error in the wiki, but not in the actual email that is sent.

Email template preview with highlighted customization
Output after customization


Testing the templates

To test changes to the single notification template, wiki admins can use the page Special:NotificationTester and follow the instructions on the page.




To submit feedback about this documentation, visit our community forum.

No categories assignedEdit

Discussions