Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
312 views
in Technique[技术] by (71.8m points)

html - Gmail Email Markup not Working

I'm testing Gmail's Email Markup functionality for Parcel Deliveries, and it seems I can't get it right. This is the e-mail content after sending an e-mail to myself:

Return-Path: <[email protected]>
Received: from my-pc.local ([my.ip.add.ress])
        by mx.google.com with ESMTPSA id 68sm3737559qgz.8.2015.01.29.06.06.37
        for <[email protected]>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 29 Jan 2015 06:06:38 -0800 (PST)
Date: Thu, 29 Jan 2015 11:06:33 -0300
From: "Test Name" <[email protected]>
To: [email protected]
Subject: Your package is on its way
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/html; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.23 (2014-03-12)

<html>
  <body>
    <script type="application/ld+json">
    {
      "@context": "http://schema.org",
      "@type": "ParcelDelivery",
      "deliveryAddress": {
        "@type": "PostalAddress",
        "streetAddress": "Test Address",
        "addressLocality": "Test locality",
        "addressRegion": "Test Region",
        "addressCountry": "CL",
        "postalCode": "7551234"
      },
      "expectedArrivalUntil": "2015-02-12T12:00:00-04:00",
      "carrier": {
        "@type": "Organization",
        "name": "Test org"
      },
      "itemShipped": {
        "@type": "Product",
        "name": "iPod Mini"
      },
      "partOfOrder": {
        "@type": "Order",
        "orderNumber": "176057",
        "merchant": {
          "@type": "Organization",
          "name": "Test Org 2"
        },
        "orderStatus": "OrderInTransit"
      },
      "trackingUrl": "http://track.com/track/1234567890",
      "trackingNumber": "1234567890"
    }
    </script>
    <p>Test paragraph</p>
  </body>
</html>

The markup is valid according to the markup validator. There are recommended (but not required) fields that I'm missing. Adding them doesn't help.

I have also tried the microdata format with no luck so far:

<html>
  <body>
    <div itemscope itemtype="http://schema.org/ParcelDelivery">
      <div itemprop="deliveryAddress" itemscope itemtype="http://schema.org/PostalAddress">
        <meta itemprop="streetAddress" content="Test Address"/>
        <meta itemprop="addressLocality" content="San Francisco"/>
        <meta itemprop="addressRegion" content="CA"/>
        <meta itemprop="addressCountry" content="US"/>
        <meta itemprop="postalCode" content="94107"/>
      </div>
      <meta itemprop="expectedArrivalUntil" content="2015-01-12T12:00:00-08:00"/>
      <div itemprop="carrier" itemscope itemtype="http://schema.org/Organization">
        <meta itemprop="name" content="Test Carrier"/>
      </div>
      <div itemprop="itemShipped" itemscope itemtype="http://schema.org/Product">
        <meta itemprop="name" content="iPod Mini"/>
      </div>
      <div itemprop="partOfOrder" itemscope itemtype="http://schema.org/Order">
        <meta itemprop="orderNumber" content="176057"/>
        <div itemprop="merchant" itemscope itemtype="http://schema.org/Organization">
          <meta itemprop="name" content="Bob Dole"/>
        </div>
        <meta itemprop="orderStatus" content="OrderInTransit"/>
      </div>
      <meta itemprop="trackingUrl" content="http://track.com/track/1234567890"/>
      <meta itemprop="trackingNumber" content="1234567890"/>
    </div>
    <p>Test paragraph</p>
  </body>
</html>

What am I missing?

I'm using mutt to send the e-mail:

mutt -e "set content_type=text/html" [email protected] -s "Your package is on its way" < test.html

Or without content type:

mutt [email protected] -s "Your package is on its way" < test.html
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If you use Google SMTP relay, you have to use an SPF record looking like this :

600 IN TXT "v=spf1 a include:_spf.google.com ~all"

Source: https://support.google.com/a/answer/178723?hl=en


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...