Hi  @pieter
Try this
function filter_private_message_email_body( $email_content, $sender_name, $subject, $content, $message_link, $settings_link, $ud ) {
    $content = substr( $content , 0, 140 );
    $email_content = sprintf( __(
'%1$s sent you a new message:
Subject: %2$s
"%3$s"
To view and read your messages please log in and visit: %4$s
---------------------
', 'buddypress' ), $sender_name, $subject, $content, $message_link );
    return $email_content;
}
add_filter( 'messages_notification_new_message_message', 'filter_private_message_email_body', 10, 7 );
This will make the message 140 characters. Feel free to change the 140 to another number.
		
	 
	
	
	
 
		
			
		
			
	
	
		
		Thanks a lot both of you.
Works like a charm. 🙂
		
	 
	
	
	
 
		
			
	
	
		
		Thanks for pointing out wp_trim_words()!
		
	 
	
	
	
 
		
			
	
	
		
		How can I add “Dear username” at the beginning of the email message?
I have tried adding $user_id to the function with `    $user = get_userdata( $user_id );
‘Dear ‘ . $user->user_login . ‘,`
but it does not return any value.
Any idea?
		
	 
	
	
	
 
		
			
	
	
		
		$ud is a WP_User object of the person who is receiving the message. So:
function filter_private_message_email_body( $email_content, $sender_name, $subject, $content, $message_link, $settings_link, $ud ) {
    $content = wp_trim_words( $content, 15 );
    $email_content = sprintf( __(
'Dear %1$s,
%2$s sent you a new message:
Subject: %3$s
"%4$s"
To view and read your messages please log in and visit: %5$s
---------------------
', 'buddypress' ), $sender_name, $subject, $content, $message_link, $ud->user_login );
    return $email_content;
}
add_filter( 'messages_notification_new_message_message', 'filter_private_message_email_body', 10, 7 );
		
	 
	
	
	
 
		
			
	
	
		
		Thanks  @henrywright.
The order of the variables should read $ud->user_login, $sender_name, $subject, $content, $message_link
		
	 
	
	
	
 
		
			
	
	
		
		Of course, sorry. Glad you figured it out 🙂
		
	 
	
	
	
 
		
			
	
	
		
		This stopped working, even in BP 2.5.3
Should I upgrade to 2.6 to get it back?
		
	 
	
	
	
 
		
			
	
	
		
		This is not working anymore, even with the latest ugrades to BP 2.6.1.1 and WP 4.5.3.
Also the emails arrive in non-html version.
Who can clear this up?
Thanks in advance,
Pieter
		
	 
	
	
	
 
		
			
	
	
		
		I would also like to know this. I used the code from this thread and it worked fine, but now it has stopped working. Help?
		
	 
	
	
	
 
		
			
	
	
		
		I don’t have an exact fix but I went into “Emails” from the WordPress Sidebar and edited the email that is sent on a new message sent trigger. I just took out the {{subject}} and {{quot}} tags and then just put a message that they have to login to view the message. hth
		
	 
	
	
	
 
		
			
	
	
		
		Hi  @empressdianna,
You did it right ! Thanks for sharing. I close this topic now, as initial issue is now resolved.