2017-02-16 8 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