Email notification footer with links for Reply Privately, Sender Profile, and User Profile

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]( for help on posting by email.


  • 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.

Topic is held in topic_title, You can see it defined several times in this file.

One problem I’m seeing is that the spaces in topics are breaking my links - That I haven’t found a solution for.

I have removed some of the IMO unnecessary fanciness in

* [Reply to sender privately](%{base_url}/new-message?username=%{username}&title=Your%20post%20on%20%{site_title}&body=Regarding%20your%20topic%20at%20%{base_url}%{url}) about this topic.

changing it to

* [Reply to sender privately](%{base_url}/new-message?username=%{username}) about this topic.

Because spaces in the site title aren’t being URL encoded, this caused support requests for us. It is also unnecessary; you could simply hard-code the name of your site since the customization is per site anyway, like so:

* [Reply to sender privately](%{base_url}/new-message?username=%{username}&title=Your%20post%20on%EXAMPLE.COM&body=Regarding%20your%20topic%20at%20%{base_url}%{url}) about this topic.

Note that the params are:

  • Title → Your post on EXAMPLE.COM
  • Body → Regarding your topic at

I added two new parameters that can be used in the 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}).


This is Broken in new installations as detailed here


Yes, this is still broken. Even in my two year old installation. Any chance that this will be fixed? I’m not sure I understand the workaround….

1 Like

Sorry for bumping an old topic, but I’m being asked about this today. As noted in the last replies to this topic, the example code in your post no longer works. The error that is returned when I attempt to add it to the User Posted email template is The following interpolation key(s) are invalid: "base_url, username, url".

We can get by with hard coding the site’s base_url into the template. I think the url can also be omitted - the %{topic_title_url_encoded}placeholder if probably good enough for setting the title. What is needed to allow the new PM link to work from an email is to be able to get the post author’s username in the email template. Is there any way that the username parameter could be made available to the template again? If it was, something like this would work for the link:

[Reply to author privately](http://localhost:3000/new-message?username=%{username}&title=Regarding%20your%20post:%20%{topic_title_url_encoded})

Edit: I’d been testing this by adding the link directly to the User Posted email template. Reading the topic’s OP now, I see that it’s about adding the link to the user_notifications.reply_by_email translation key. When the link is added to that key, the error returned is: The following interpolation key(s) are invalid: "username, topic_title_url_encoded". So to fix the issue for that case, the username and topic_title_url_encoded values would need to be available.


This should be working after this fix: