如何在电子邮件主题中添加链接(gmail) [英] How to add link in subject of email (gmail)

查看:261
本文介绍了如何在电子邮件主题中添加链接(gmail)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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





在我的代码中,我尝试以下但仍然不能令人满意的结果。以下代码正在以主题的形式发送主题。

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

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


解决方案

我很高兴你问!这是Google支持的一个令人敬畏的新功能和标准,它是Schema.org计划的一部分。



将他们的示例复制到此,让客户直接从电子邮件中查看!该块将直接复制到您的邮件模板中。

 < script type =application / ld + json> 
{
@context:http://schema.org,
@type:餐厅,
name:Google Cafe
action:{
@type:ReviewAction,
review:{
@type:评论,
reviewRating :{
@type:评级,
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/


Is there a way to add link in subject of email? Following is the example of YouTube -

Here in my code I'm trying the following but still unsatisfactory result. The below code is sending the subject as it is with printing the whole anchor tag in the subject.

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);
}

解决方案

I'm glad you asked! This is an awesome new feature and standard Google is supporting, part of the Schema.org initiative.

Copying their example here which allows customers to review something directly from the email! This block would be copied directly into your mail template.

<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>

Documentation on how to activate these features can be found here: https://developers.google.com/gmail/actions/

这篇关于如何在电子邮件主题中添加链接(gmail)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆