Patrick's Programming Blog

Change From Address in Ninja Forms

gmail inbox
  1. Blogging for Benjamin Competition
  2. Why I'm Grateful to Work on the Web
  3. 24 Pull Requests
  4. Update Downloadable Product's Expiration Date in WooCommere
  5. Get Lost in the Flow and Work for More Than a Salary
  6. Why A Plugin's Popularity Matters
  7. Why You Should (Or Shouldn't) Use Premium Plugins
  8. WooCommerce Terms & Conditions
  9. Only Ship to Continental United States with WooCommerce
  10. Just Talk
  11. Why I Love Jetpack
  12. Making Jetpack Better
  13. Remove Billing Address for Free Virtual Orders in WooCommerce
  14. Notify Admin of Customer Address Change in WooCommerce
  15. Open Your Self Up To New Possibilities
  16. 2013 Resolutions Review
  17. Create a Community
  18. Tips for Starting a Community
  19. The Intent of Goals
  20. Create The Ultimate Invoicing System Using WooCommerce
  21. Change From Address in Ninja Forms
  22. Work With People Who Inspire You
  23. Contact Form 7 & MailPoet Integration
  24. Monotasking
  25. Giving Back to The Community
  26. Adding Fuctionality to Lean Plugins
  27. Choose Stripe For a Payment Gateway
  28. A Dip Into Entrepreneurship
  29. Reward Yourself
  30. Blogging for Benjamin Plugin
  31. Blogging for Benjamin Wrap Up

Guess what I did today? I sent an email to noreply@speakinginbytes.com. Why did I send an email to a noreply@{domain} address? And why to my own domain? Because as I was flying through my email using all of my fancy gmail shortcuts I opened an email, pressed r to reply typed up a response pressed tab and return and let it fly. Only then did realize that I sent it to my own domain. What would've been really handy in this situation would be a way to automatically change the from address in emails that already contain the requestor's email address.

A quick Google search will turn up this great post by the WP Ninjas (the guys who make Ninja Forms) about dynamically changing the email address. This is actually a really great solution because you can specify exactly which fields you want to use for the name & email address as well as which forms you want to apply this to. The only down side is that it isn't plug & play – and I like plug and play. That way if I ever create another form or modify my form by adding or deleting fields it will still work.

Automagically Change the From Address!

Change the from address

So to take care of issue I wrote a little plugin, Ninja Forms – Change From Address. If you want to use this plugin you can go to the homepage, download it, extract the zip file, and upload the folder to your /wp-content/plugins/ directory of your site. It will automatically work with every form on your site.

Basically this plugin is going to loop through all of your fields and if you included name fields or email fields it will use to to automatically replace those in the notification email that gets sent to the administrator. Now you can reply to the email that gets sent and it will go to the correct person!

Only Apply This to Certain Forms

I'm sure there's a use case where a user doesn't want this to apply to all forms. If that's the case I would check out that original blog post by the WP Ninjas and look into restricting it to only certain forms by adding a conditional check.

Happy replying!

Photo Credit: notoriousxl via Compfight cc

Exit mobile version