Hi there!
You can only redirect unlogged users the users from the messages page to your login page. This is example of code how to do it:
add_action( 'template_redirect', 'my_redirect_if_user_not_logged_in' );
function my_redirect_if_user_not_logged_in(){
$page_id = 8437; // Messages page ID
if ( ! is_user_logged_in() && is_page($page_id) ) {
$link = add_query_arg('redirect', urlencode(get_permalink($page_id)), 'https://youwebsite.com/login/');
wp_redirect( $link );
exit;
}
}