How can i access woocommerce order variables inside shortcode?

WooCommerce Email template already has access to $order variable. You simply need to add it to shortcode atts, like this

do_shortcode('[sample_test name="additional_gift_msg" order_id=' . $order->get_id() . ']');

Then in the shortcode callback:

function th_email_shortcode_handler( $atts ) {
    // get the $order_id
    $order_id = $atts['order_id'];

    // create the order object if needed
    $order = new WC_Order( $order_id );

    if ( ! empty( $atts['name'] ) ) {
        $field = $atts['name'];
        echo 'Found me';
    }
}

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