使用 gmail api 发送新邮件后如何获取邮件 ID?

How to get the message id after sending a new message with gmail api?

如何在使用 gmail 发送新邮件后获取邮件 ID api?

function sendMessage(userId, email, callback) {
  var base64EncodedEmail = btoa(email);
  var request = gapi.client.gmail.users.messages.send({
    'userId': userId,
    'message': {
      'raw': base64EncodedEmail
    }
  });
  request.execute(callback);
}

我找到了解决方案: 在回调函数中,我们将获得一个参数对象,其中包含有关已发送消息的所有信息,例如 id 、labelId ...等:

 function callback(){
    var idMail=arguments[0].id;
    /*Stored into the dataBase or others operations */
 }