无法使用 Gmail API 从邮​​件中获取按钮 link

Can't get button's link from message using Gmail API

我正在尝试从 Gmail 的邮件中获取按钮的 link(例如验证帐户按钮)。有什么方法可以通过 Google API?

我使用 Api 先获取所有消息:https://www.googleapis.com/gmail/v1/users/me/messages

然后使用此 api 获取消息详细信息:https://www.googleapis.com/gmail/v1/users/me/messages/{message_id}

但在电子邮件正文中找不到 link,这是回复!!

{
"id": "1785a64978e454be",
"threadId": "1785a528dc1e905c",
"labelIds": [
    "IMPORTANT",
    "CATEGORY_PERSONAL",
    "INBOX"
],
"snippet": "Invesna Logo Hello Turki Thank you for joining our community Best wishes INVESNA Team Verify Now This is an automated email. If you've received this email by mistake, please",
"payload": {
    "partId": "",
    "mimeType": "multipart/alternative",
    "filename": "",
    "headers": [
        {
            "name": "Delivered-To",
            "value": "areeb.*****@gmail.com"
        },
        {
            "name": "Received",
            "value": "by 2002:a6b:916:0:0:0:0:0 with SMTP id t22csp3887526ioi;        Mon, 22 Mar 2021 07:44:05 -0700 (PDT)"
        },
        {
            "name": "X-Google-Smtp-Source",
            "value": "ABdhPJyvgEKiYNby+5oLp9d6ZLU4ujfWHmppkGFvw2POAHup5hfkbaexaDRj9bwjk1zLmhyuIfsq"
        },
        {
            "name": "X-Received",
            "value": "by 2002:ac8:4752:: with SMTP id k18mr234477qtp.158.1616424245098;        Mon, 22 Mar 2021 07:44:05 -0700 (PDT)"
        },
        {
            "name": "ARC-Seal",
            "value": "i=1; a=rsa-sha256; t=1616424245; cv=none;        d=google.com; s=arc-20160816;        b=cTBJJWs+fBO2mU4nAKoz+VzfvNI7RrAW3PKApijZ0LI4v6Ma1XAQxKilc+IEiwcmFE         D6cTkU9CVAS9f+IOaE3bb8NCnQVz7mFvFkD72vvDeWaMsW2V2jbKZoFPdFKDGZ6b70fq         WUXxy5uCHkafF9gAtmPFU2eTfMRRk5uv3ZA8XGcO87JWSYngzz/DoOdD6cQOVfIiv4HF         YGAITJGHTYL2kgwdRVlSJCKQBpQZIJqM3pUHaYJ3+uXs2rg1XkaLyFudF3brG7tKUOMN         gCXsyINhAfuTw2bIrWmSX+8B3AHG+h+aQfTbl9GNr3oBLYYM7BRMSfG2S8jldm6XnEpM         ZUEg=="
        },
        {
            "name": "ARC-Message-Signature",
            "value": "i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;        h=feedback-id:mime-version:to:from:subject:date:message-id         :dkim-signature:dkim-signature;        bh=RToLBuWpZqa2f+3AtVt2tvS0pNeSTnAA4DQnGQ8mMWU=;        b=prTkhBY/VOg77E8LDGE3HZD7rGb2vQuG2uln53Jh3ee4fXIKZtB6RwVUjBrodFyb6S         FXUbY0Iox/TWv+Maqr0p89waYhGYy/aQD4g6G3/8BwLSCqAOc65JsKMGwGor/t2ZdsOZ         w97c2w3eswYEfu9FuhXyCLV9Jbg/4bw32JWb59mKuAQSKx6aeiipXShmPmAmI5FWxlmu         y/dbft5H4weUd3jXQjbAqXnfzyEso+nbl2iexfobZ4vqRPzarwk9tSZEC73mgqbsA5ZF         zx9xPOYxJbMVin5Wrsit0p8xVv3DD1UlPGqNCItAviqUkHqtUDkznPmiWpFXtXLxoyk2         3SyA=="
        },
        {
            "name": "ARC-Authentication-Results",
            "value": "i=1; mx.google.com;       dkim=pass header.i=@areebgroup.com header.s=ly5fxy3f4dncdbipp3gron65eulkyt3p header.b=XztlZ3Jb;       dkim=pass header.i=@amazonses.com header.s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug header.b=FtocR6ro;       spf=pass (google.com: domain of 010001785a649518-d06bf9df-a011-4cee-81ed-9328a70eaa39-000000@amazonses.com designates 54.240.48.108 as permitted sender) smtp.mailfrom=010001785a649518-d06bf9df-a011-4cee-81ed-9328a70eaa39-000000@amazonses.com"
        },
        {
            "name": "Return-Path",
            "value": "<010001785a649518-d06bf9df-a011-4cee-81ed-9328a70eaa39-000000@amazonses.com>"
        },
        {
            "name": "Received",
            "value": "from a48-108.smtp-out.amazonses.com (a48-108.smtp-out.amazonses.com. [54.240.48.108])        by mx.google.com with ESMTPS id cj6si7995790qvb.74.2021.03.22.07.44.04        for <areeb.testing2@gmail.com>        (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-SHA bits=128/128);        Mon, 22 Mar 2021 07:44:05 -0700 (PDT)"
        },
        {
            "name": "Received-SPF",
            "value": "pass (google.com: domain of 010001785a649518-d06bf9df-a011-4cee-81ed-9328a70eaa39-000000@amazonses.com designates 54.240.48.108 as permitted sender) client-ip=54.240.48.108;"
        },
        {
            "name": "Authentication-Results",
            "value": "mx.google.com;       dkim=pass header.i=@areebgroup.com header.s=ly5fxy3f4dncdbipp3gron65eulkyt3p header.b=XztlZ3Jb;       18-d06bf9df-a011-4cee-81ed-9328a70eaa39-000000@amazonses.com"
        },
        {
            "name": "DKIM-Signature",
            "value": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ly5fxy3f4dncdbipp3gron65eulkyt3p; d=areebgroup.com; t=1616424244; h=Message-ID:Date:Subjec"
        },
        {
            "name": "DKIM-Signature",
            "value": "v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ug7nbtf4gccmlpwj322ax3p6ow6yfsug; d=amazonses.com; t=1616424244; h=Message-ID:Date:Subject:Fro"
        },
        {
            "name": "Message-ID",
            "value": "<010001785>
        },
        {
            "name": "Date",
            "value": "Mon, 22 Mar 2021 14:44:04 +0000"
        },
        {
            "name": "Subject",
            "value": "Verify Your Account"
        },
        {
            "name": "From",
            "value": "Invesna <account@aree>"
        },
        {
            "name": "To",
            "value": "areeb.**@gmail.com"
        },
        {
            "name": "MIME-Version",
            "value": "1.0"
        },
        {
            "name": "Content-Type",
            "value": "multipart/alternative; boundary=\"_=_swift_1616424243_8452744c94a6060ff23d75c5b712dcb6_=_\""
        },
        {
            "name": "X-SES-Outgoing",
            "value": "2021.03.22-54.240.48.108"
        },
        {
            "name": "Feedback-ID",
            "value": "1.us-ea"
        }
    ],
    "body": {
        "size": 0
    },
    "parts": [
        {
            "partId": "0",
            "mimeType": "text/plain",
            "filename": "",
            "headers": [
                {
                    "name": "Content-Type",
                    "value": "text/plain; charset=utf-8"
                },
                {
                    "name": "Content-Transfer-Encoding",
                    "value": "quoted-printable"
                }
            ],
            "body": {
                "size": 5094,
                "data": "PCFET0NUWVBFIGh0bWw-DQo8aHRtbCBsYW5nPSJlbiI-DQo8Ym9keT4NCjxkaXYgc3R5bGU9ImJhY2tncm91bmQtY29sb3I6ICNmN2Y5ZmM7IHBhZGRpbmctYm90dG9tOiAzcmVtIj4NCiAgICA8aW1nIHNyYz0iaHR0cDovL2FwaS10ZXN0LmludmVzbmEud9JbnZlc25hX2FwcCIgdGFyZ2V0PSJfYmxhbmsiPg0KICAgICAgICAgICAgICAgICAgICAgICAgPGltZw0KICAgICAgICAgICAgPg0KPC9ib2R5Pg0KPC9odG1sPg0K"
            }
        },
        {
            "partId": "1",
            "mimeType": "text/html",
            "filename": "",
            "headers": [
                {
                    "name": "Content-Type",
                    "value": "text/html; charset=utf-8"
                },
                {
                    "name": "Content-Transfer-Encoding",
                    "value": "quoted-printable"
                }
            ],
            "body": {
                "size": 10026,
                "data": "PCFkb2N0eXBlIGh0bWw-DQo8aHRtbCBsYW5nPSJlbiI-PGJvZHkgc3R5bGU9ImZvbnQtZmFtaWx5OiAtYXBwbGUtc3lzdGVtLCBCbGlua01hY1N5c3RlbUZvbnQsICdTZWdvZSBVSScsIFJvYm90bywgSGVsdmV0aWNhLCBBcmlhbCwgc2Fucy1zZXJpZiwgJ0FwcGxlIENvbG9yIEVtb2ppgYWx0PSJQYXR0ZXJuIiBzdHlsZT0iZm9udC1mYW1pbHk6IC1hcHBsZS1zeXN0ZW0sICAgICAgPC91bD4NCjwvZGl2Pg0KICAgIDwvZGl2Pg0KPC9kaXY-DQo8L2JvZHk-PC9odG1sPg0K"
            }
        }
    ]
},
"sizeEstimate": 20887,
"historyId": "79",
"internalDate": "16164240"

}

已解决,我的邮件正文是用base64编码器编码的,我先解码然后找到我需要的link

参考: