Filter: postie_filter_email3

This filter is called when Postie extracts the “from” email address. Typically you would use this filter if you wanted to use the email headers to decide which email address should be used to identify the WordPress user.
At the point the filter is called there is no post created.
Parameters:
  • $fromEmail – the email address that the email is from. Note that filters postie_filter_email and postie_filter_email2 could have modified this already.
  • $headers – an array of all the email headers received. Note that this will vary depending on where the email came from. You can get a sense of what is possible here: https://tools.ietf.org/html/rfc2076
add_filter('postie_filter_email3', 'my_filterEmail3', 10, 2);

function my_filterEmail3($fromEmail, $headers) {
    if (array_key_exists('Sender', $headers)) {
        $fromEmail = $headers['Sender'];
    }
    return $fromEmail;
}

See also: