Add condition in contact form mail tab
In the Contact Form 7 plugin, you can add conditions to the Mail tab to customize the email sending process. Here are the steps:
- Go to the Contact Form 7 plugin settings page and click on the "Mail" tab.
- Click on the "Add Rule" button.
- In the "Condition" dropdown menu, select the condition you want to add (e.g. "Is equal to", "Is not equal to", "Is checked", etc.).
- In the "Value" field, enter the value you want to check against (e.g. a specific text, a checkbox value, etc.).
- In the "Then" dropdown menu, select the action you want to take if the condition is true (e.g. "Send email", "Do not send email", etc.).
- Click "Add Rule" to save the condition.
Here are some examples of conditions you can add:
- Send email only if the "Name" field is not empty:
is not empty
in the "Value" field, and "Send email" in the "Then" dropdown menu. - Send email only if the "Phone" field is checked:
is checked
in the "Value" field, and "Send email" in the "Then" dropdown menu. - Send email only if the "Message" field contains the word "urgent":
contains
in the "Value" field, and "urgent" in the "Value" field, and "Send email" in the "Then" dropdown menu.
You can add multiple conditions by clicking the "Add Rule" button again. The conditions will be evaluated in the order they are added, and the email will be sent only if all conditions are true.
For example, you can add two conditions:
- Send email only if the "Name" field is not empty and the "Phone" field is checked:
is not empty
in the first "Value" field, and "Send email" in the first "Then" dropdown menu, andis checked
in the second "Value" field, and "Send email" in the second "Then" dropdown menu.
By adding conditions to the Mail tab, you can customize the email sending process and ensure that the email is sent only when the form is submitted with the desired information.