Book Sale! Code WP2025 takes 20% OFF our Pro Plugins & Books »
Web Dev + WordPress + Security

WordPress Hack: Multiple Email Recipients for Contact Coldform

In the current version of my custom contact-form WordPress plugin, Contact Coldform, there is no built-in method of sending emails to multiple addresses. The thought of adding such functionality had not occurred to me until recently, when a Coldform user asked about enabling it. After a bit of investigation, it turns out that integrating multiple-recipient functionality into Contact Coldform is as easy as it is practical. I will definitely be adding this feature to the next release of the Coldform, however, here is the modification procedure for those who just can’t wait.

Step 1:

Open contact_coldform.php and locate the following code:

$recipient = get_option('coldform_email');
$recipname = get_option('coldform_name');
$recipsite = get_option('coldform_website');
$success   = get_option('coldform_success');
$success   = stripslashes($success);
$name      = $_POST['coldform_name'];
$email     = $_POST['coldform_email'];

Step 2:

Above that block of code, add the following 4 lines:

// CUSTOM EDIT: MULTIPLE RECIPIENTS
$alt_email_01 = "email@domain.tld";
$alt_email_02 = "email@domain.tld";
$alt_email_03 = "email@domain.tld";

Step 3:

Edit this new code according to your needs. For example, you can add or remove lines to match the number of alternate recipients. Of course, you will also want to edit the email address listed in each line.

Step 4:

Locate this block of code, located around line #235 (or so):

if ($_POST['coldform_carbon'] == 'TRUE') {
	mail($email, $topic, $fullmsg, $headers);
}

Step 5:

Immediately above that code, add the following 4 lines:

// CUSTOM EDIT: MULTIPLE RECIPIENTS
mail($alt_email_01, $topic, $fullmsg, $headers);
mail($alt_email_02, $topic, $fullmsg, $headers);
mail($alt_email_03, $topic, $fullmsg, $headers);

That’s it! Save the file and upload. Once everything is configured correctly, you should begin receiving a copy of the Coldform-generated email at each additionally specified email address. Should work perfectly. If you need any further help with this mod, please leave a comment or contact me directly. Thanks!

About the Author
Jeff Starr = Fullstack Developer. Book Author. Teacher. Human Being.
Banhammer: Protect your WordPress site against threats.

3 responses to “WordPress Hack: Multiple Email Recipients for Contact Coldform”

  1. SystemRunner 2008/12/02 2:27 pm

    Hey Jeff,

    Was reading this post and noticed that it might be beneficial if the alternate email addresses could be achieved via a select-option menu on the actual form, instead of using the Carbon Copy method you have listed here.

    Just some food for thought on the next release of Coldform!

    -Ray

  2. Thanks for the idea, Ray, I am adding it to the list of upgrade features that I am planning on implementing in the next version of the Coldform. I really wish I had more time to work on my plugins and themes! ;)

  3. i need contact form with combo box menu for choosing recipient. any idea how to build that?

Comments are closed for this post. Something to add? Let me know.
Welcome
Perishable Press is operated by Jeff Starr, a professional web developer and book author with two decades of experience. Here you will find posts about web development, WordPress, security, and more »
Banhammer: Protect your WordPress site against threats.
Thoughts
Replacing my elaborate 27in iMac desk setup with a 15in Macbook Air.
Launching my new plugin, Head Meta Pro 🚀 Complete meta tags for WordPress.
Migrating sites to a new server, so far so good. Please report any bugs, thank you.
Arc browser looked good but lost me at “account required”. No browsers do that.
Finishing up the pro version of Head Meta Data plugin, launch planned this month.
Finally finished my ultimate block list to stop AI bots :) Blocks over 400+ AI bots!
After 10 years working late at night, my schedule has changed. I am now a “morning person”, starting my day at 6am or earlier.
Newsletter
Get news, updates, deals & tips via email.
Email kept private. Easy unsubscribe anytime.