Recently I was setting up a contact form for a client using Contact Form 7, it had a ton of form fields and a ton of mail tags. Luckily I was able to automate part of the process and saved hours of time the first night I used the snippet.
The form contained quite a few fields (98 to be exact) and took a few hours to setup just the form side:
When I finished I realized that now under the mail tab I was going to have to insert each field mail tag into the outgoing email:
I decided this part could be automated to save me tons of time, so I wrote a quick snippet of code that can loop through the mail tags and add it to the end of the emails message body. It also generates a label based off the tab, for this it replaces dashes and underscores with spaces as well as capitalizing each word.
To use this code simply copy it into your browsers console then sit back and relax!
And with that, I leave you with this quote:
I will always choose a lazy person to do a difficult job because a lazy person will find an easy way to do it.
William Henry Gates III