Contact Form 7 – Dynamically Set (To) Admin Email Address

Most of us here in WordPress community have known and used the Contact Form 7(CF7) throughout our entirety. I personally have used it in every single website I have built. Unless client wants otherwise. It is my go to plugin. It is simple, tried and tested and well maintained since dawn of the dinosaurs (you get the idea).

But there is one little thing that I came to know recently. Hmmnnn……

So, what happens is, when you create a website, install and activate the Contact Form 7 plugin, it will automatically get the site’s admin email address from Settings > General > Administration Email Address
Generally, this email address will be developers generic email address or could be clients generic email address.

Let’s say you have created five different forms and all five forms now have same admin email address as “To” field.
When deploying the site,  now the generic admin email address is to be changed. The issue here is, CF7 will not automatically detect the change in admin email address and we manually have to go to each form and change the “To” recipient email address to new. Not so happy, are you?

Heck, we might even forget it and never change it manually until someone reminds us about it.

So, to solve this, we can use “special mail tags” like [_site_admin_email] from the start and do not worry about change in the admin email address ever, well if it is intended in that way.
So, here you go Special mail-tags of CF7 is the answer.

2 responses to “Contact Form 7 – Dynamically Set (To) Admin Email Address”

Leave a Reply

Your email address will not be published. Required fields are marked *