Insert variables into email subject

More
22 Feb 2014 14:18 - 30 Apr 2015 17:53 #1 by Graeme Moffat
Insert variables into email subject was created by Graeme Moffat
Keywords can be placed in both the subject line and the body of the emails sent to the addresses set in
  • Message delivery > Mail Options > Email to (the admin's email)
  • Events > Send a copy to the submitter > Email subject
And they can also be placed in the text that displays when a form is successfully submitted
  • Events > Text to display when events occur > Thank you text
These keywords will be replaced by either selected fields from the submitted form, or properties derived from Joomla itself.
Example: Request {id} from {user} - {name} about {dropdown1} at {date} {time}
becomes: Request 149 from jcitizen - Joe Citizen about Pitchforks at 2014-02-22 21:30

The keywords:

Note: Keywords are case-insensitive, ie {date} is the same as {DATE} or {Date} or {dAtE} etc.


Special Variables
{date}The date in the server's timezone. The format depends on the current language.
{time}The time in the server's timezone 'hh:mm'
{user}If the submitter is logged on as a registered user, this is their username.
If the submitter is not logged on, then this is 'User not logged in'
{id}A unique id, the same as the 'id' field in the database enquiries that can be exported to CSV
This keyword is not yet implemented

Form Fields
{name}The submitter's name
{email}The submitter's email address
{dropdown0}Note 1The selected value of the first dropdown list
{dropdown1}The second dropdown. And {dropdown2} etc...
{text0}Note 1Text as entered into the first text field
{text1}The second text field. And {text2} etc...
{checkbox0}Note 1The state of the first checkbox. This will be either 'Yes' or 'No'
{checkbox1}The second checkbox. And {checkbox2} etc...
{textarea0}The first textarea. And {textarea1} etc...
{calendar0}The first date/time field. And {calendar1} etc...

Email Body Variables Note 2
{field-table-full}All the fields present in the current form, including attachments list and client information
{field-table-without-client-info}All the fields present in the current form, except for client information
{field-table-without-attachments}All the fields present in the current form, except for the attachments
{field-table}Without the attachments list and client information
{sitename}The name of the website as defined under Joomla Global Configuration
{page-title}The HTML title of the page where the form is
{current-url}The URL of the page where the form is
{attachments}The list of attachments
{client-ip-address}The IP of the client, with GeoIP information if available

Notes:
  1. It is important to understand that the numbering of each different type of field starts at zero, using the order that the fields appear in the backend (administrator) 'Form fields' tab, NOT the order in which they appear on the form.
    By default, these are the same, but the 'Ordering' value set for each field can change this, as can whether the field's 'State' is "Disabled" or not.
  2. While these email body variables can be included in the email subjects and thank you text, it is not recommended.

Possible uses:
  • Probably the most useful of these will be a {dropdownx} value where the user selects a particular product/department etc. and the receiver's email can be set to filter that value to a particular inbox, for example.
  • The unique {id} (or a unique time-stamp, using '{date} {time}'), could be used by 3rd-party applications in the generation of sales leads.
  • Again, anything unique can be used to prevent an email client, that groups emails with the same subject into threads/conversations, from doing so.

Versions
The special variables and form fields were introduced for the admin's email subject in versions 3.2.3 and 2.5.19
These were extended to the submitter's email subject in versions 3.4.1 and 2.5.23, and the thank you text in 3.4.3 and 2.5.24
The email body variables were added with the introduction of HTML-based email, for both the admin and submitter , in 3.4.1 and 2.5.23
Attachments:
The following user(s) said Thank You: shimda

Please Log in or Create an account to join the conversation.