AI Summary
Description
The wpforms_emails_mailer_get_from_address
filter allows you to customize the “From” email address used when WPForms sends an email. For example, you may want to send form notifications from a domain-specific email address for branding or deliverability purposes.
By default, this address is taken from the WordPress admin email setting if no other value is set.
parameter | type | description |
---|---|---|
$from_address | string | The current “From” email address. Defaults to the WordPress admin email if none is set. |
$email | object | The email object instance. Provides access to email templates and properties. |
Source
wpforms/src/Emails/Mailer.php
Example
/**
* Change the From email address for all WPForms notifications
* when sending from a specific domain.
*
* @link https://wpforms.com/developers/wpforms_emails_mailer_get_from_address/
*
* @param string $from_address The current From email address.
* @param object $email The email object instance.
*
* @return string
*/
function wpf_dev_custom_from_address( $from_address, $email ) {
// Use a custom From address for all WPForms emails.
// Be sure the domain matches your site domain for best results.
$from_address = '[email protected]';
return $from_address;
}
add_filter( 'wpforms_emails_mailer_get_from_address', 'wpf_dev_custom_from_address', 10, 2 );