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;
}