Title: Conditional Mail Tags
Last modified: September 1, 2016

---

# Conditional Mail Tags

 *  [strandcreative](https://wordpress.org/support/users/strandcreative/)
 * (@strandcreative)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/conditional-mail-tags/)
 * Is it possible to hide content inside the body of the mail if the user hasn’t
   filled the text field out?
 * We have built a booking form for a bus jounrey and if the user selects “one way”
   which is a radio button, the title called “return date” still appears in the 
   mail message.
 * E.G.
 *     ```
       Return Date:[return-date] - [return-time]:[return-minutes]
       ```
   
 * I’ve tried using other plugins but they do not work. Can this be achieved through
   the use of a hook/filter/shortcode to achieve something like the below?
 * E.G.
 *     ```
       [if radiobutton="Return"]
       Return Date:[return-date] - [return-time]:[return-minutes]
       [/if]
       ```
   
 * Thanks
 * [https://wordpress.org/plugins/contact-form-7/](https://wordpress.org/plugins/contact-form-7/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [LESIMOON](https://wordpress.org/support/users/lesimoon/)
 * (@lesimoon)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/conditional-mail-tags/#post-7611570)
 * Check [this tuto](https://wordpress.org/support/topic/tuto-conditional-form-with-required-field?replies=1).
   it might help you.
    Working example [here](http://www.lemagxxlait.com/1000-2/)
 *  Thread Starter [strandcreative](https://wordpress.org/support/users/strandcreative/)
 * (@strandcreative)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/conditional-mail-tags/#post-7611583)
 * Thanks but this isn’t quite what I want. I can hide/show fields with jQuery fine
   on the front end, my problem is when we get the email through it contains the
   word **Return Date** whether the user has chosen “One Way” or “Return”:
 *     ```
       Journey Type:	One Way
       Start Date:	24/07/2016 - 1:00
       Return Date:	(blank space)
       ```
   
 * and
 *     ```
       Journey Type:	Return
       Start Date:	12/09/16 - 1:00
       Return Date:	14/09/16 - 1:00
       ```
   
 * I have typed “Return Date” out in the email body so if the user has selected “
   One Way” radio button on the front end, they still get a section of their email
   that says:
 * `Return Date: (blank space)`
 * I need to remove these words if the user selects the “One Way” option value on
   the radio button.
 * Thanks
 *  [LESIMOON](https://wordpress.org/support/users/lesimoon/)
 * (@lesimoon)
 * [9 years, 9 months ago](https://wordpress.org/support/topic/conditional-mail-tags/#post-7611652)
 * If I understand, your form is working well but the problem appear in the mail
   sent?
 * Check “Exclude lines with blank mail-tags from output” box in the Mail section.
   It should fix the problem.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Conditional Mail Tags’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-7/assets/icon.svg?rev=2339255)
 * [Contact Form 7](https://wordpress.org/plugins/contact-form-7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7/reviews/)

## Tags

 * [mail](https://wordpress.org/support/topic-tag/mail/)

 * 3 replies
 * 2 participants
 * Last reply from: [LESIMOON](https://wordpress.org/support/users/lesimoon/)
 * Last activity: [9 years, 9 months ago](https://wordpress.org/support/topic/conditional-mail-tags/#post-7611652)
 * Status: not resolved