Special Mail Tags

There are times when you may wish to follow more than just the user’s input through the contact form. For example, you may wish to know the client’s IP address for security reasons. Contact Form 7 provides some special mail tags for such purposes. You can insert these special mail tags into the Message Body field or other fields in the Mail section.

Tag Description
[_remote_ip] This tag will be replaced by the sender’s client IP address.
[_url] This tag will be replaced by the URL of the contact form.
[_date] This tag will be replaced by the date of the submission.
[_time] This tag will be replaced by the time of the submission.
[_post_id] This tag will be replaced by the ID of the post which contains the contact form.
[_post_name] This tag will be replaced by the name (slug) of the post which contains the contact form.
[_post_title] This tag will be replaced by the title of the post which contains the contact form.
[_post_url] This tag will be replaced by the permalink of the post which contains the contact form.
[_post_author] This tag will be replaced by the author name of the post which contains the contact form.
[_post_author_email] This tag will be replaced by the author email of the post which contains the contact form.

Note that the [_post_*] tag has value only when you put the contact form into content of a post or a page. They are not available if the contact form is put inside a sidebar widget.

The form of those special mail tags has been changed in Contact Form 7 2.2. Old form ([wpcf7.*]) are still supported and able to work.

6 responses to “Special Mail Tags”

  1. Zia

    Hi Miyoshi,

    Updated to latest CF7 2.1 and it works like a charm.
    Thanx for your improvements.

  2. sharath

    thanks… i was looking for this IP trick.. contact form 7 rocks!!

  3. Simon Zumbrunnen

    Hi!
    Thx for this great plugin! Couldn’t you make something like a [wpcf7.user_name] to show the name of the logged in user? And the same for the user mail?
    That would be very usefull…

  4. David

    YOU ARE A GENIUS!!! Sorry for ’shouting’ but I simply couldn’t help it. You made it so much easier for me :)
    Thanks for your time and an excellent plug-in!
    David

  5. Sergejs

    Amazing, really! I use multiple instances of basically the same order form for different products, and these tags really help me to identify the correct orders. They make my web administration life so much easier. Thank you!

  6. Gahlord Dewald

    Something that would incredibly useful would be a special tag that grabbed the utm_source utm_campaign utm_medium utm_term and utm_content variables from the GA cookie.

    I realize that this would only work on sites with ga.js installed. But it would provide super-high value information for those of us calculating ROI on lead-gen marketing initiatives.

    If you’ve been considering a paid-version of this plugin, this might be the feature to do it with. Of course, I’d love it if it stayed free too. :)