2015-09-14 17 views
0

我想知道如何實現與PayPal相同的電子郵件結構。如何將貝寶等結構化數據添加到Google電子郵件標記?

它看起來像這樣(在谷歌的收件箱):

Email, showing PayPal logo, and reading 'Receipt for Coursera, Inc.', listing amount, issuer, date and confirmation number

但我不能在這裏找到合適的類型:https://developers.google.com/gmail/markup/reference/

任何想法如何實現貝寶般的標記?

+0

我找不到標記來實現這一目標對谷歌的在線文檔也是如此。我開始研究有關的標記schema.org @AaronP後(http://stackoverflow.com/questions/32304322/defining-a-bill-or-invoice-using-google-email-markup)爲好。看起來他們使用「發票」(https://schema.org/Invoice)標記。我測試了schema.org文檔中提供的json/microdata示例,但是它沒有在Inbox中觸發任何內容。 您也可以嘗試尋找您的支付寶郵件的原始來源,並期待在它的標記。檢查文檔以獲取更新。 – Franco

+0

查看下面的答案,讓我知道這是你想要實現的。 – Franco

+0

檢查出谷歌的發票https://developers.google.com/gmail/markup/reference/invoice更新文檔。 – Franco

回答

0

使用schema.org/Invoice和schema.org/PayAction,我能夠獲得您從PayPal發佈的電子郵件結構。它還生成了「查看帳單」按鈕,該按鈕僅顯示在收件箱中,而不是Gmail中。看看下面的示例腳本。 email markup tester似乎喜歡它,沒有發現錯誤。嘗試使用此Gmail Schema Tester或通過Apps Script與您的Gmail帳戶一起發送。

<script type="application/ld+json"> 
 
[ 
 
{ 
 
    "@context": "http://schema.org", 
 
    "@type": "Invoice", 
 
    "description": "January 2015 Acme Bill", 
 
    "url": "https://www.americanexpress.com", 
 
    "accountId": "xxxx-xxxx-xxxx-1234", 
 
    "potentialaction": { 
 
     "url": "https://example.com", 
 
     "@type": "PayAction" 
 
    }, 
 
    "paymentDue": "2020-01-30", 
 
    "minimumPaymentDue": { 
 
     "@type": "PriceSpecification", 
 
     "price": "$15.00" 
 
    }, 
 
    "totalPaymentDue": { 
 
     "@type": "PriceSpecification", 
 
     "price": "$200.00" 
 
    }, 
 
    "paymentStatus": "payment due", 
 
    "provider": { 
 
     "@type": "Organization", 
 
     "name": "Acme Bank" 
 
} 
 
} 
 
] 
 
    </script>

你應該得到這樣的:

enter image description here

相關問題