![Thunderbird logo](https://assets-prod.sumo.prod.webservices.mozgcp.net/media/uploads/products/2024-02-12-07-36-53-599028_1.png)
Using if then else in TO field
I use Mail Merge frequently. I would like to be able to use and if then else statement in the TO field to select the recipient based on a conditional. I have done this in the past, and had found a reference for doing it but I can no longer find that reference. So if anyone can point me to a site that describes how to to use conditionals in Thunderbird I would appreciate it. Thanks in advance.
Izabrano rješenje
Support for the mail merge addon is provided by the author. https://addons.thunderbird.net/en-us/thunderbird/addon/mail-merge/
That page also offers the following advice
Variable: {{name}}
The variable will be replaced by the value of the field name, e.g.:
{{FirstName}}: the variable will be replaced by the value of the field FirstName
{{LastName}}: the variable will be replaced by the value of the field LastName
{{PrimaryEmail}}: the variable will be replaced by the value of the field PrimaryEmail
Variable: {{name|if|then}} If the value of the field name equals if, then the variable will be replaced by then.
Variable: {{name|if|then|else}} If the value of the field name equals if, then the variable will be replaced by then, else by else.
Variable: {{name|*|if|then|else}} (includes)
If the value of the field name includes if, then the variable will be replaced by then, else by else.
Variable: {{name|^|if|then|else}} (starts with) If the value of the field name starts with if, then the variable will be replaced by then, else by else.
Variable: {{name|$|if|then|else}} (ends with) If the value of the field name ends with if, then the variable will be replaced by then, else by else.
Variable: {{name|==|if|then|else}} (equal to) (number)
If the value of the field name is equal to if, then the variable will be replaced by then, else by else.
Variable: {{name|>|if|then|else}} (greater than) (number) If the value of the field name is greater than if, then the variable will be replaced by then, else by else.
Variable: {{name|>=|if|then|else}} (greater than or equal to) (number) If the value of the field name is greater than or equal to if, then the variable will be replaced by then, else by else.
Variable: {{name|<|if|then|else}} (less than) (number) If the value of the field name is less than if, then the variable will be replaced by then, else by else.
Variable: {{name|<=|if|then|else}} (less than or equal to) (number) If the value of the field name is less than or equal to if, then the variable will be replaced by then, else by else.
Nested Variables:
Variables can be nested. For example: To create individual emails only for your premium customers, you can add something like this in the To field:
{{FirstName}} {{LastName}} <{{Premium|x|{{Email}}}}>
{{Premium|x|{{Email}}}}
Warning: (Variables in the From / To / Cc / Bcc / Reply fields)
Advanced variables like "includes", "starts with" and "ends with" as well as the "numbers" may not work as expected in the From / To / Cc / Bcc / Reply fields!
All Replies (2)
Odabrano rješenje
Support for the mail merge addon is provided by the author. https://addons.thunderbird.net/en-us/thunderbird/addon/mail-merge/
That page also offers the following advice
Variable: {{name}}
The variable will be replaced by the value of the field name, e.g.:
{{FirstName}}: the variable will be replaced by the value of the field FirstName
{{LastName}}: the variable will be replaced by the value of the field LastName
{{PrimaryEmail}}: the variable will be replaced by the value of the field PrimaryEmail
Variable: {{name|if|then}} If the value of the field name equals if, then the variable will be replaced by then.
Variable: {{name|if|then|else}} If the value of the field name equals if, then the variable will be replaced by then, else by else.
Variable: {{name|*|if|then|else}} (includes)
If the value of the field name includes if, then the variable will be replaced by then, else by else.
Variable: {{name|^|if|then|else}} (starts with) If the value of the field name starts with if, then the variable will be replaced by then, else by else.
Variable: {{name|$|if|then|else}} (ends with) If the value of the field name ends with if, then the variable will be replaced by then, else by else.
Variable: {{name|==|if|then|else}} (equal to) (number)
If the value of the field name is equal to if, then the variable will be replaced by then, else by else.
Variable: {{name|>|if|then|else}} (greater than) (number) If the value of the field name is greater than if, then the variable will be replaced by then, else by else.
Variable: {{name|>=|if|then|else}} (greater than or equal to) (number) If the value of the field name is greater than or equal to if, then the variable will be replaced by then, else by else.
Variable: {{name|<|if|then|else}} (less than) (number) If the value of the field name is less than if, then the variable will be replaced by then, else by else.
Variable: {{name|<=|if|then|else}} (less than or equal to) (number) If the value of the field name is less than or equal to if, then the variable will be replaced by then, else by else.
Nested Variables:
Variables can be nested. For example: To create individual emails only for your premium customers, you can add something like this in the To field:
{{FirstName}} {{LastName}} <{{Premium|x|{{Email}}}}>
{{Premium|x|{{Email}}}}
Warning: (Variables in the From / To / Cc / Bcc / Reply fields)
Advanced variables like "includes", "starts with" and "ends with" as well as the "numbers" may not work as expected in the From / To / Cc / Bcc / Reply fields!
Many thanks, that is exactly the page/information I was looking for.