Plugin Author
bnfw
(@voltronik)
sorry, I already have these filters but what I need is different from email and reply-to-email.
I have another small issue. for email (notification=email-changed) the email is always in plain text, despite setting it in HTML. I checked the received email and it states the content-type header is set to plain text.
-
This reply was modified 3 years, 6 months ago by
muneebkiani.
-
This reply was modified 3 years, 6 months ago by
muneebkiani.
I managed to fix the issue with the help of the following filter but it would really helpful if you add bn specific plugin so we can override headers only for specific notifications
function pixel_mod_reply_email($args){
$headers[] = 'Content-type: text/html';
$headers[] = 'Reply-To: vertrieb <vertrieb@schultes.eu>';
$args['headers'] = $headers;
return $args;
}
add_filter('wp_mail','pixel_mod_reply_email', 10,2);
Plugin Author
bnfw
(@voltronik)
Hi @muneebkiani,
You can override the email headers for each notification within BNFW which are supported by WordPress but if you want to override any others (those that can’t be filtered) then you’ll need to use a blanket function, such as the one I shared in my last reply.
I’ll check the Email Changed notification and see why it’s not sending in HTML instead of plain text.
Thanks for your reply, text email issue has been resolved also.
regarding the filter, I was referring to functions like this:
/**
* Send new user registration notification email.
*
* @since 1.1
* @param array $setting Notification setting
* @param object $user User object
* @param string $password_url Plain text password in WP < 4.3 and password url in WP > 4.3
*/
public function send_registration_email( $setting, $user, $password_url = '' ) {
/**
* Whether to trigger welcome email notification or not.
*
* @since 1.7
*/
$trigger_notification = apply_filters( 'bnfw_trigger_welcome-email_notification', true, $setting, $user );
if ( ! $trigger_notification ) {
return;
}
$user_id = $user->ID;
$subject = $this->handle_shortcodes( $setting[ 'subject' ], $setting[ 'notification' ], $user_id );
$message = $this->handle_shortcodes( $setting[ 'message' ], $setting[ 'notification' ], $user_id );
$subject = str_replace( '[password]', $password_url, $subject );
$message = str_replace( '[password]', $password_url, $message );
$subject = str_replace( '[password_url]', $password_url, $subject );
$message = str_replace( '[password_url]', $password_url, $message );
$subject = str_replace( '[login_url]', wp_login_url(), $subject );
$message = str_replace( '[login_url]', wp_login_url(), $message );
if ( 'true' != $setting[ 'disable-autop' ] && 'html' == $setting[ 'email-formatting' ] ) {
$message = wpautop( $message );
}
$headers = array();
if ( 'html' == $setting[ 'email-formatting' ] ) {
$headers[] = 'Content-type: text/html';
$message = apply_filters( 'bnfw_registration_email_message', $message, $setting );
} elseif ( 'text' == $setting[ 'email-formatting' ] ) {
$message = strip_tags( $message );
}
$subject = $this->handle_global_user_shortcodes( $subject, $user->user_email );
$message = $this->handle_global_user_shortcodes( $message, $user->user_email );
wp_mail( $user->user_email, stripslashes( $subject ), $message, $headers );
}
there is no way to override the reply-to header for a specific notification. I have managed to reset reply-to globally as a workaround for now. thanks for all the support.
-
This reply was modified 3 years, 6 months ago by
muneebkiani.
-
This reply was modified 3 years, 6 months ago by
muneebkiani. Reason: code block update
Plugin Author
bnfw
(@voltronik)
Hi @muneebkiani,
Not a problem – glad you got it working.