Customize email notification footer with links to reply privately and see user profiles

AI-generated summary

scombs is sharing a customizable email notification footer for reply-by-email notifications in Discourse. The footer includes links to View Thread, reply privately to the sender, visit the sender’s profile, update user profiles, and view email tips. To implement, go to Admin → Customize → Text Content and edit the user_notifications.reply_by_email template using the provided sample code, which utilizes Discourse shortcodes. Some additional parameters, such as site_title_url_encoded, can be used to create more dynamic links. The footer uses quote markdown for styling and includes some limitations, such as the inability to pull specific topics for private replies.

To help transition listserv and email users to the online forum, I added the following footer to the reply-by-email notification. I thought I would share.

The email footer

View Thread or reply to this email. Your response will be posted to the site and emailed to the group.

  • Reply to sender privately about this topic.
  • Visit sender’s profile for more info.
  • Update your profile and set your email preferences.
  • View Email Tips for help on posting by email.

How to implement

  • Admin → Customize → Text Content
  • Edit user_notifications.reply_by_email
  • Sample code below uses Discourse shortcodes so should work for everyone.
  • Modify the text portions as needed.

Sample code

> [View Thread](%{base_url}%{url}) or reply to this email. Your response will be posted to the site and emailed to the group.

>* [Reply to sender privately](%{base_url}/new-message?username=%{username}) about this topic.
>* [Visit sender's profile](%{base_url}/users/%{username}) for more info.
>* [Update your profile](%{base_url}/my/preferences) and set your email preferences.
>* View [Email Tips](https://example.com) for help on posting by email.

Additional parameters

These additional two parameters may be useful for email notifications:

  • topic_title_url_encoded: Same as topic_title (which is the title of the topic that the notification is about) but encoded so you can use it in links.
  • site_title_url_encoded: The title of your site, encoded for use in links.

An example:

* [Reply to author privately](%{base_url}/new-message?username=%{username}&title=Your%20post%20in%{topic_title_url_encoded}&body=Regarding%20your%20post%20in%20%{base_url}%{url}).

Notes

  • Uses Discourse shortcodes for site title, site URL, topics, usernames, profile page, and compose message.
  • Uses quote markdown for styling
  • Reply privately to sender link will generate a login prompt for non-logged in users. Message composer loads after login.
  • Current limitation (I couldn’t figure it out): Cannot pull specific topic so email subject line is “Your post at {site_title}” Possibly a good thing since it distinguishes it from other topics.
  • Link to topic is included in body of private reply. Might need to tweak for one-boxing.
  • I changed the wording from “View Topic” to “View Thread” (not exactly accurate if there is only one topic and no replies but trying to shift users to the online forum).
  • You can add your own link to a “View Email Tips” post.
16 Likes