Customize subject format for standard emails

Do you know how form letters say “Dear FIRSTNAME, from CITYNAME” … it is like that.

1 Like

Well, my question is how would I correctly modify?

For instance,

for this particular forum, would this exact modification be correct?:

[%{Discourse_Meta}]

Or would I have to keep site_name in there somewhere?

Also, why in this list of email subjects is [%{site_name}] the only one with [] around it?

[%{site_name}] %{optional_pm}%{optional_cat}%{topic_title}

BTW, is this a specific code language? I could do some research on it if I knew what I was looking for


Edit:

I have learned the answer to my question!

Sharing it here would help people just like you!

1 Like

Solution

Edit: This topic offers a much more succinct summary of my ramblings below :sweat_smile:


Disclaimer – my terminology may be a little inaccurate, but I’m pretty sure I understand the basic idea. Please, correct me if I’m wrong!

Those things → %{} are called variables, and they aren’t language specific. It is basically an automated “value setting tag system” (those are my words, not an official deffinition).

The %{words_inside_the_variable_tag} are the actual variable.

When implemented, the variable tag will search the forum, and automatically replace the tag with its relevant value.


Here’s an example of what they do:

The variable tag %{site_name} as seen in this Welcome User email template

will automatically replace %{site_name} with what ever you have entered in the admin/settings/required/title field seen here:

Notice the description below the /title field – it’s pretty clear if you know what you’re looking at.

Other examples

Let’s say that a user has enabled email notifications in their profile/preferences/email settings.

The User Posted PM email template

is the template that is used to notify a user via email that they have received a personal message in the forum.

When it is time for the forum to implement this email notification, it will automatically summon the User Posted PM template, and pull the relevant values from the [PM] to replace each variable tag in the template.

So the %{topic_title} variable will automatically insert the title of the PM. The %{message} variable will automatically insert the post body of the PM. etc


Takeaway

Turns out, I don’t have to do anything to the variables themselves (which is what I was initially confused about).

If I’m not mistaken, the only things that can be modified in the email templates are:

  • the removing of variables
  • and customizing the plain text body of the template

Pretty neat stuff! :slightly_smiling_face:

2 Likes