PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Is it possible to use gform_notification_email to customise the from field(s)?

  1. I'm using the gform_notification_email filter to customise where the notification email is sent. I'm currently using to send to the WP author of the post that the form is used on. I now need to customise the from/ sender fields of this notification email.

    Currently, the notification email is sent from the user's email entered into the form itself. This has worked pretty well on our website ( http://www.barbadospropertylist.com/listings/alleynerealestate/no-219-1st-avenue-heywoods-park-st-peter/#enquiry_form ), but we have recently been running into a lot of problems with overly aggressive spam filters. So, I figured sending the notifications from 1 centralised email would help as I can then ask all of my authors/ agents to white list 1 email address.

    I would love to add a $email_from field to this, but don't know how. I searched the forum and couldn't find anything relevant. I hope it's possible to customise the from field(s).

    Here is my code from functions.php.

    add_filter( 'gform_notification_email_3', 'route_notification', 10, 2 );
    function route_notification($email_to, $entry) {
    	global $post;
    	//$email_to = get_the_author_email();
    	$email_to = get_the_author_meta('email', $post->post_author);
    	return $email_to;
    }
    Posted 13 years ago on Friday August 5, 2011 | Permalink
  2. I don't believe there is currently a hook for the Send From email address, only the Send To. Can you not configure the Send From in the Notification settings in the admin?

    Posted 13 years ago on Friday August 5, 2011 | Permalink
  3. That totally works! Thanks.

    Posted 13 years ago on Friday August 12, 2011 | Permalink
  4. Thank you for the update!

    Posted 13 years ago on Friday August 12, 2011 | Permalink

This topic has been resolved and has been closed to new replies.