How do I create a shortcode that returns a logged in users’ email?

Need to move wp_get_current_user() inside of the shortcode’s callback (untested):

function current_user_email_address() {
    if ( ! is_user_logged_in() ) {
        return '';
    }

    $user = wp_get_current_user();

    if ( empty( $user->user_email ) ) {
        return '';
    }

    return esc_html( $user->user_email );
}
add_shortcode( 'current_user_email_address', 'current_user_email_address' );

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)