2017-02-16 28 views
0

私はGOを使用し、sendgrid API v3(https://github.com/sendgrid/sendgrid-goメールヘルパークラスなし)でメールを送信しようとしました。私はこのコードを使用する場合でも:SendGrid v3経由でHTMLコンテンツを送信

"content": [ 
    { 
     "type": "text/html", 
     "value": "<html><head></head><body>Hello You link <a href="http://example.com/reschedule?id=12334">Click</a></body></html>" 
    } 
    ], 

を私はエラーを取得:

400 {"errors":[{"message":"Bad Request","field":null,"help":null}]}

をしかし、このコードは正しく動作:

"content": [ 
    { 
     "type": "text/html", 
     "value": "<html><head></head><body>Hello!</body></html>" 
    } 
    ], 

私は特殊文字での問題を考えるが、私は修正することができますかそれ?ありがとうございました!

+1

問題がある可能性があり、 '" 'あなたの[値]の内側に、あなたは"' – Alessio

答えて

1

は、これを行う必要があります。

<div class=\"ad_box\"><img class=\"banner\" src=\"some_ad.png\" alt=\"\" \/> 

Example 
    "content": [ 
     { 
      "type": "text/html", 
      "value": "<html><head></head><body>Hello You link <a href=\"http://example.com/reschedule?id=12334\">Click</a></body></html>" 
     } 
     ], 
+0

ええ、あなたはあなたの中-HTMLの引用符をエスケープする必要が '配置する必要があります。 – jacobmovingfwd

関連する問題