Page MenuHomePhabricator

Implement HTML e-mail support in MediaWiki
Open, NormalPublic

Description

Author: dunc_harris

Description

There should be an option to receive emails in either plain text or html format (note that Echo already has HTML email, this is for other emails).

Receiving emails in html format would allow the sender to use wiki markup to help convey his message across.

The standard core emails, i.e.

  • email confirmation and password reset,
  • enotiftalk,
  • enotifwatchlist

would benefit from being available in HTML format as well.

An initial implementation

  • keep the very same content
  • and ideally reuse translations (split in multiple messages?);
  • put links in a tags;
  • ensure choice, between plain text and HTML, either a) client-side (when the plain text+HTML message is delivered), and/or b) server-side (configuration setting to decide default/only option), and/or c) user-side (preference somewhere).

Subsequent steps

  • change defaults;
  • add styling;
  • augment content;
  • allow other pieces of core and extensions to reuse standard parts for their own emails or to alter existing ones (this should preferably take into account that Echo has HTML email and figure out a way to reduce/avoid redundancy);
  • deprecate overlapping features in other areas of the code.

Advantages

  • [high] links which don't break, even in stupid clients unable to handle punctuation and even with long percent-encoded titles,
  • [mid] choice and customisations,
  • [minor] compactness,
  • [debatable] prettyness.

Disadvantages (in case of inadequate implementation)

  • preferences clutter,
  • lack of support in clients,
  • degradation of i18n for years until translations are re-added in all languages.

Current todos

  1. Finding a way to not have separate messages for plain-text and HTML, which is something I mentioned in one of the patches.
  2. There still needs to be a way to make templates for the emails, i.e., some sort of wrapper that the email content will be injected into.
  3. Then, of course, the actual graphic design of the templates themselves, including approval of the design by whoever would be relevant in WMF.
  4. Working on improving the content of other emails other than just page change notifications.

Implementation tips

Creating HTML emails that look good in common clients (which cripple the HTML in various ways) is a bit of a black art; you probably want to grab some sort of boilerplate (e.g. Zurb has some nice ones).

Some interesting stuff you can do with HTML email: T106651: Enrich Wikimedia email with Schema.org metadata

Internship project details

  • Primary mentor: @Parent5446
  • Co-mentor: @01tonythomas
  • Other mentors: (optional, Phabricator username)
  • Skills: (Phabricator tags are welcome)
  • Estimated project time for a senior contributor: (must be 2-3 weeks)
  • Microtasks: T48109, T31856, T62434

Details

Reference
bz13303

Related Objects

StatusAssignedTask
InvalidWikinaut
OpenNone
OpenNone
Declinedrosalieper
DeclinedDevirk
InvalidPreetika09
InvalidNone
DeclinedGalorefitz
ResolvedParent5446
ResolvedGalorefitz
ResolvedGalorefitz
OpenGalorefitz
InvalidGalorefitz
Resolved01tonythomas
ResolvedGalorefitz
DeclinedNone
DeclinedAyahsoufan
OpenNone
OpenNone

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

i am interested in this project @Parent5446 and i want to work on it....
But finding it difficult to download the files...

i am interested in this project @Parent5446 and i want to work on it....
But finding it difficult to download the files...

Thank you for your interest, @Lewizho99 . If you have specific questions, please take a look at https://www.mediawiki.org/wiki/How_to_become_a_MediaWiki_hacker#Feedback.2C_questions_and_support and shoot, so that we can reply.

@01tonythomas @Parent5446 I am interested in working on this. By when will microtasks be listed for this project?

tahteche added a subscriber: tahteche.EditedMar 7 2016, 4:20 PM

Hello I am interested in taking up this task for the Google summer of code and will like to be assigned some microtask.

Since no microtasks have been assigned for the moment, I took initiative to work on some other easy task close to Emails hence I submitted a patch to T128769 . Does it count?

01tonythomas updated the task description. (Show Details)Mar 10 2016, 6:11 AM

I have added some microtasks in the description, and do take a look!

@tahteche : Everything counts, and it is more about getting your change merged, than pushing in a patch, if its about numbers. Volunteering is open for every one, and Thank you for your interest in contributing.

Tgr added a comment.Mar 10 2016, 6:24 AM

@Legoktm is this still relevant, in light of T128351?

@Parent5446
i am Krishni Andradi,

Computer engineering undergraduate university of peradeniya, Sri lanka.

i would like to do this project during GSOC 2016. and i have implemented such a project during my industrial training period.
using java, mustache etc, and i have gone through string template, pegdown etc. while selecting best frameworks.

So i think i would be able to do this project successfully during this summer if i got selected.

Dalba awarded a token.Mar 18 2016, 5:26 AM

@Parent5446
i would like to do this project during GSOC 2016. and i have implemented such a project during my industrial training period.
using java, mustache etc, and i have gone through string template, pegdown etc. while selecting best frameworks.

So i think i would be able to do this project successfully during this summer if i got selected.

Thank you for your interest, and please take a look at https://www.mediawiki.org/wiki/Outreach_programs/Life_of_a_successful_project#Coming_up_with_a_proposal and come up with a proposal for the same.

Aashaka removed a subscriber: Aashaka.Mar 21 2016, 6:16 AM
01tonythomas updated the task description. (Show Details)Apr 2 2016, 5:34 PM

Added one more micro-task T62434

As a quick note for both this task in general and for @rosalieper and @Galorefitz, we spoke with @siebrand yesterday, and asked him about the two approaches for this task, i.e.:

  1. Have a single i18n message in plain text and then convert the message to HTML when needed. (This is the method @Galorefitz describes in T130490).
  2. Have two i18n messages, one in plain text and one in HTML, and then choosing between the two. (This is the method used in https://gerrit.wikimedia.org/r/249155.)

@siebrand said that the latter approach is preferred, as the former single-message approach will lead to incorrect i18n when linkifying information or doing other HTML-specific formatting that sometimes comes out differently depending on the translation. Therefore for this bug we should stick with the approach used in the already open patches and keep two separate messages for each email.

keep two separate messages for each email

This is ok as long as whatever method actually has a translation (i.e. plain text, initially) is always preferred to the method which would force English onto the user.

  1. Have a single i18n message in plain text and then convert the message to HTML when needed. (This is the method @Galorefitz describes in T130490).

@Parent5446 I actually proposed the second method in my proposal, not the first, i.e.,

  1. Have two i18n messages, one in plain text and one in HTML, and then choosing between the two. (This is the method used in https://gerrit.wikimedia.org/r/249155.)

in this part :

  • When generating a key to be passed to wfMessage(), it will be assumed that if the key does not end with -html, the text is wikitext/plaintext. If the caller of the function wishes to include html in the text, the key must be appended by -html.
    • When the key sent ends with -html, we can run wfMessage($key)->exists() on it, and if it does not exist, we can use the key without the ending -html, assuming that version exists. This will be done so that even if an html version of the text exists and the caller wants to use the plaintext version, they have an option to do so. This will require discussion with the i18n team. Allowing arbitrary HTML in the messages will have security concerns that will need to be looked into and taken care of.

And as @Nemo_bis pointed out,

keep two separate messages for each email

This is ok as long as whatever method actually has a translation (i.e. plain text, initially) is always preferred to the method which would force English onto the user.

I have already accounted for that in my proposal (quoted above). Incase the html version of key (say hello-html) does not exist in a particular language, the method should automatically fallback to the plaintext version of the message (in this case, message with key hello), assuming it exists.

  1. Have a single i18n message in plain text and then convert the message to HTML when needed. (This is the method @Galorefitz describes in T130490).

@Parent5446 I actually proposed the second method in my proposal, not the first, i.e.,

I was referring to the transformContentToHtml function mentioned in Phase 1. I'm saying we should probably skip that and directly use Phase 3's concept, which does as you said. Sorry for the confusion.

This is not the best microtask yet, but definitely got something to do with i18n, and is for the MediaWiki-extensions-Newsletter :D. Candidates, T132155 needs your love!

Osnard added a subscriber: Osnard.Jun 22 2016, 8:16 AM

Is a location/time during the Hackathon already known?

Is a location/time during the Hackathon already known?

I'm removing the Wikimania-Hackathon-2016 tag as this is an ongoing Google-Summer-of-Code (2016) project. Thank you for your interest @Osnard. You can comment your views on the selected proposal T130490, which tracks the progress.

Okay, thank you

@Parent5446 has agreed to mentor the same again for the upcoming Outreachy round 13 :) Adding this as a featured project now!

KathAmbers added a subscriber: KathAmbers.EditedSep 22 2016, 7:35 PM

Hi

I was searching for Outreachy projects and stumbled upon this. I was reading these comments and quite frankly, I am much too confused. I saw the dashboard and there is an email feature in the notif's "preferences" which clearly asks for rich text and plain mails. I can't seem to know what this task requires for I think it is there already, correct me if I am wrong. I am fairly new here!

Please guide me in it. I would be really happy! Thanks a lot in advance! @Parent5446

I was searching for Outreachy projects and stumbled upon this. I was reading these comments and quite frankly, I am much too confused. I saw the dashboard and there is an email feature in the notif's "preferences" which clearly asks for rich text and plain mails. I can't seem to know what this task requires for I think it is there already, correct me if I am wrong. I am fairly new here!

That setting (Notification tab in preferences) only applies to Echo notifications.

This task is for other emails, including:

  • email confirmation
  • password reset,
  • enotiftalk
  • enotifwatchlist
  • And apparently user-to-user email ("allow the sender to use wiki markup to help convey his message across")
Pearl added a subscriber: Pearl.Sep 22 2016, 8:39 PM
Tgr added a comment.Sep 22 2016, 9:23 PM

This task should probably be coordinated with the shepherd of T128351: RfC: Notifications in core.

Liuxinyu970226 awarded a token.

Would @Parent5446 or some of the other subscribers on this thread be interested in mentoring this task for the Rails Girls Summer of Code: http://railsgirlssummerofcode.org? For the very first time, we are considering to submit Wikimedia's application for this program. It is like Outreachy, and has the same goal of fostering diversity in Open Source. Though it sounds from the name that the projects submitted should be in ROR/ Rails but that's not true. Projects could be any programming language. It will run between July-September 2017? In case you are interested, a faster reply would be much appreciated, as we are pretty close to the deadline to apply as an organization (January 31st, less than 6 days remaining!) :) Thank you!

srishakatux added a comment.EditedMar 1 2017, 8:11 PM

Would anyone be willing to mentor this project for Google Summer of Code 2017 or Outreachy Round 14? Remember, each outreach project requires a minimum of one primary mentor and co-mentor.

srishakatux added a comment.EditedSep 5 2017, 9:22 AM

Would there be any interest in mentoring this project for Outreachy Round 15? Application period opens in two days. See a few other ideas for projects that we are promoting for the upcoming round https://www.mediawiki.org/wiki/Outreachy/Round_15

Elitre added a subscriber: Elitre.Oct 13 2017, 3:58 PM

Hello, @srishakatux , @Parent5446 , @01tonythomas, I wish to work on this for the upcoming GSOC round. Adding some few microtasks will help. I hope its not too early . I prefer to maximize my chances :).

Would there be any interest in mentoring this project for GSoC'18 or Outreachy'16?

@rosalieper We are currently compiling a list of project ideas for the next round. In the meanwhile, you can try to fix some bugs here > https://www.mediawiki.org/wiki/Annoying_little_bugs. That way you will be better prepared :)

Is there anyone available to mentor this project for GSoC 2018?

Adding Outreach-Programs-Projects and removing Possible-Tech-Projects as we are planning on killing that workboard soon!