Auto login to Wordpress using user email id or id

Using inbuilt functions of Wordpress user can do auto login for the application. As a client requirement my wordpress need auto login using user email id, so after doing some google i came to know about function wp_set_current_user() which sets the current user (but does not do auto login) and wp_set_auth_cookie sets the authentication cookies using User ID. Below is the complete code i got it from the function page: My current Wordpress version: 3.9
$email = $_GET['email'];
$user = get_user_by( 'email', $email );
if( $user ) {    
    wp_set_current_user( $user->ID, $user->user_login );
    wp_set_auth_cookie( $user->ID );
    do_action( 'wp_login', $user->user_login );
} 
wp_redirect( home_url() ); 
exit;
[si-contact-form form='1']



Your feedbacks are most welcome..