如何从Google API PHP获取电子邮件地址

I am trying to figure out how to use the Gmail API to get the email address from a message, but it seems like when the data is sent, the actual email address get's escaped out of existence, leaving only the person's name. Here is an example of a response that I get that should have the user's email address (Formatted as PHP Array):

 Array ( [0] => Array ( [name] => To [value] => John Smith ) ) 

But, when I try it out on the Gmail API Documentation page, I get a response like this (Formatted as JSON):

"headers": [
   {
    "name": "To",
    "value": "John Smith \u003cjohnsmith@test.com\u003e"
   }
  ]

Now, I'm not sure what is going on, but it seems that the backslashes and everything in between them, including the email address that I need, is being escaped before I even have a chance at getting to it. Is there some way to avoid this so that I can get the email address from the response? Here is the current code that I am using now:

require_once __DIR__ . '/google-api-php-client/src/Google/autoload.php';



$client_email = "myclientemail";
$private_key = file_get_contents('myprivatekey');
$scopes = array('https://www.googleapis.com/auth/gmail.modify');
$userId = 'myuserid';
$credentials = new Google_Auth_AssertionCredentials(
    $client_email,
    $scopes,
    $private_key,
    'notasecret',                                 // Default P12 password
    'http://oauth.net/grant_type/jwt/1.0/bearer', // Default grant type
    $userId
);
$client = new Google_Client();
$client->setAssertionCredentials($credentials);
if ($client->getAuth()->isAccessTokenExpired()) {
  $client->getAuth()->refreshTokenWithAssertion();
}
$service = new Google_Service_Gmail($client);

$opt_param = array(
    'format'=>'metadata',
    'metadataHeaders' => 'To'
  );

    $message = $service->users_messages->get($userId, "messageid", $opt_param);
print_r($message);