如何在电子邮件主题中添加链接 (gmail)

2022-08-30 22:17:36

有没有办法在电子邮件主题中添加链接?以下是YouTube的例子 -

enter image description here

在我的代码中,我正在尝试以下但仍然不满意的结果。下面的代码正在发送主题,就像在主题中打印整个锚点标记一样。

public function contact_us($data)
{
    $from = "from@example.com";
    $to = "to@example.com";
    $view = 'emails/contact_us';
    $subject = "Contact Us <a href='http://www.example.com'>Link</a>";
    $view_data = $data;

    $this->send($from,$to,$subject,$view,$view_data);
}

答案 1

我很高兴你问!这是一个很棒的新功能,谷歌正在支持的标准,是 Schema.org 计划的一部分。

在这里复制他们的示例,允许客户直接从电子邮件中查看某些内容!此块将直接复制到您的邮件模板中。

<script type="application/ld+json">
{
  "@context":               "http://schema.org",
  "@type":                  "Restaurant",
  "name":                   "Google Cafe",
  "action": {
    "@type":                "ReviewAction",
    "review": {
      "@type":              "Review",
      "reviewRating": {
        "@type":            "Rating",
        "bestRating":       "5",
        "worstRating":      "1"
      }
    },
    "handler": {
      "@type":              "HttpActionHandler",
      "url":                "{{ review_url }}",
      "encoding": {
        "url":              "http://schema.org/Encoding/UrlEncoded"
      },
      "method":             "http://schema.org/HttpRequestMethod/POST",
      "requiredProperty": {
        "@type":            "Property",
        "name":             "review.reviewRating.ratingValue"
      },
      "optionalProperty": {
        "@type":            "Property",
        "name":             "review.reviewBody"
      }
    }
  }
}
</script>

有关如何激活这些功能的文档,请参阅:https://developers.google.com/gmail/actions/


答案 2

推荐