Skip to main content

benecaster_email_from_address

Filter Free Since v1.0.0

Filters the sender email address for any Benecaster email.

A type-specific variant is available — append the email type to the hook name (e.g. benecaster_email_from_address_welcome) to target a single type; the $email_type parameter is omitted on the type-specific variant.

Important — SPF/DKIM/DMARC alignment: The From address must be on a domain your mail provider is authorized to send from. Changing it to an unverified domain will cause SPF or DMARC alignment failures at the receiving server, which means emails are rejected or routed to spam. If you set a show-specific From address, verify that domain with your SMTP provider (SendGrid, Postmark, Mailgun, etc.) before using it here.

Parameters

Name Type Default Description
$from_address string Sender email address
$email_type string Email type string
$user_id int|null WordPress user ID; null for admin-only emails
$show_id int|null ID of the show; null when not show-specific

Returns: string

Example

add_filter( 'benecaster_email_from_address', function( $from_address, $email_type, $user_id, $show_id ) {
    // Use a show-specific reply-to address for broadcasts.
    if ( 'broadcast' === $email_type && $show_id ) {
        $custom = get_post_meta( $show_id, '_benecaster_from_email', true );
        return $custom ?: $from_address;
    }
    return $from_address;
}, 10, 4 );