{"id":19609,"date":"2025-10-23T11:30:20","date_gmt":"2025-10-23T02:30:20","guid":{"rendered":"https:\/\/sendgrid.kke.co.jp\/blog\/?p=19609"},"modified":"2025-10-22T18:17:45","modified_gmt":"2025-10-22T09:17:45","slug":"twilio-sendgrid%e3%83%a9%e3%82%a4%e3%83%96%e3%83%a9%e3%83%aa%e3%81%a7%e9%80%81%e4%bf%a1%e3%83%aa%e3%82%af%e3%82%a8%e3%82%b9%e3%83%88%e3%81%a8%e3%83%ac%e3%82%b9%e3%83%9d%e3%83%b3%e3%82%b9%e3%82%92-7","status":"publish","type":"post","link":"https:\/\/sendgrid.kke.co.jp\/blog\/?p=19609","title":{"rendered":"Twilio SendGrid\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u3068\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5 \uff5eGo\u7de8\uff5e"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2025\/10\/20251023_blog.png\" alt=\"Twilio SendGrid\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u3068\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5 \uff5eGo\u7de8\uff5e\" width=\"100%\" class=\"aligncenter size-full wp-image-19610\" srcset=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2025\/10\/20251023_blog.png 650w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2025\/10\/20251023_blog-300x185.png 300w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2025\/10\/20251023_blog-225x139.png 225w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/p>\n<p>\u30e1\u30fc\u30eb\u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u5b9f\u884c\u3057\u305f\u306e\u306b\u3001<a href=\"https:\/\/sendgrid.kke.co.jp\/docs\/Tutorials\/C_Manage_Events\/using_activity.html\" rel=\"noopener\" target=\"_blank\">Activity<\/a>\u3084<a href=\"https:\/\/sendgrid.kke.co.jp\/docs\/Tutorials\/C_Manage_Events\/using_event_webhook.html\" rel=\"noopener\" target=\"_blank\">Event Webhook<\/a>\u306b\u30a4\u30d9\u30f3\u30c8\u304c\u8a18\u9332\u3055\u308c\u3066\u3044\u306a\u3044\uff01\u3068\u3044\u3046\u7d4c\u9a13\u306f\u3042\u308a\u307e\u305b\u3093\u304b\uff1f\u30a4\u30d9\u30f3\u30c8\u304c\u767a\u751f\u3057\u306a\u3044\u4e3b\u306a\u539f\u56e0\u3068\u3057\u3066\u3001Twilio SendGrid\u306b\u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u304c\u5c4a\u3044\u3066\u3044\u306a\u3044\u53ef\u80fd\u6027\u304c\u8003\u3048\u3089\u308c\u307e\u3059\u3002\u554f\u984c\u304c\u767a\u751f\u3057\u305f\u969b\u306b\u539f\u56e0\u3092\u3057\u3063\u304b\u308a\u7279\u5b9a\u3067\u304d\u308b\u3088\u3046\u3001\u5b9f\u969b\u306b\u9001\u3063\u305fJSON\u5f62\u5f0f\u306e\u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u3068\u305d\u306eHTTP\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u5fc5\u305a\u30ed\u30b0\u306b\u51fa\u529b\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>SMTP\u3084Web API\u3067\u9001\u4fe1\u3059\u308b\u5834\u5408\u306f\u3001Telnet\u3084cURL\u306a\u3069\u306e\u30c4\u30fc\u30eb\u306b\u3088\u3063\u3066\u7c21\u5358\u306b\u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u3068\u30ec\u30b9\u30dd\u30f3\u30b9\u304c\u53d6\u5f97\u3067\u304d\u308b\u306e\u3067\u3001<a href=\"https:\/\/sendgrid.kke.co.jp\/docs\/Tutorials\/A_Transaction_Mail\/send_transaction_mail.html\" rel=\"noopener\" target=\"_blank\">\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb<\/a>\u3092\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002\u4eca\u56de\u306e\u30d6\u30ed\u30b0\u3067\u306f\u3001<a href=\"https:\/\/github.com\/sendgrid\/sendgrid-go\" rel=\"noopener\" target=\"_blank\">Go\u5411\u3051\u306eSendGrid\u30e9\u30a4\u30d6\u30e9\u30ea<\/a>\uff08\u4ee5\u964d\u3001sendgrid-go\u3068\u8868\u8a18\uff09\u306b\u304a\u3051\u308b\u53d6\u5f97\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001<a href=\"https:\/\/go.dev\/\" rel=\"noopener\" target=\"_blank\">Go<\/a> 1.25.0\u3067\u78ba\u8a8d\u3057\u307e\u3057\u305f\u3002<\/p>\n<h3>sendgrid-go\u3092\u4f7f\u3063\u305f\u9001\u4fe1\u51e6\u7406\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/h3>\n<p>\u30e9\u30a4\u30d6\u30e9\u30ea\u306fgo get\u30b3\u30de\u30f3\u30c9\u3092\u5229\u7528\u3057\u3066\u53d6\u5f97\u3057\u307e\u3059\u3002\u74b0\u5883\u5909\u6570\u306b\u683c\u7d0d\u3057\u305fAPI\u30ad\u30fc\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u3001godotoenv\u30e9\u30a4\u30d6\u30e9\u30ea\u3082\u4f75\u305b\u3066\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\ngo get github.com\/sendgrid\/sendgrid-go@latest\r\ngo get github.com\/joho\/godotenv@latest&quot;github.com\/joho\/godotenv&quot;\r\n<\/pre>\n<p>sendgrid-go\u3092\u4f7f\u3063\u305f\u9001\u4fe1\u30b3\u30fc\u30c9\u306f\u6b21\u306e\u3068\u304a\u308a\u3067\u3059\u3002<br \/>\n<a href=\"https:\/\/github.com\/sendgrid\/sendgrid-go\/tree\/main\/helpers\/mail\" rel=\"noopener\" target=\"_blank\">Mail Helper Class<\/a>\u3092\u5229\u7528\u3059\u308b\u3068\u3001\u3088\u308a\u7c21\u5358\u306b\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n\r\npackage main\r\n\r\nimport (\r\n\t&quot;encoding\/json&quot;\r\n\t&quot;fmt&quot;\r\n\t&quot;os&quot;\r\n\r\n\t&quot;github.com\/sendgrid\/sendgrid-go&quot;\r\n\t&quot;github.com\/sendgrid\/sendgrid-go\/helpers\/mail&quot;\r\n\t&quot;github.com\/joho\/godotenv&quot;\r\n)\r\nfunc main() {\r\n\t\/\/\u74b0\u5883\u5909\u6570\u306e\u8aad\u307f\u8fbc\u307f\r\n\terr_read := godotenv.Load()\r\n \tif err_read != nil {\r\n      \t\tlog.Fatalf(&quot;error: %v&quot;, err_read)\r\n \t}\r\n\t\/\/ \u5dee\u51fa\u4eba\r\n\tfrom := mail.NewEmail(&quot;\u69cb\u9020\u592a\u90ce&quot;, &quot;***&quot;)\r\n\t\/\/ \u5b9b\u5148\r\n\tto := mail.NewEmail(&quot;\u69cb\u9020\u82b1\u5b50&quot;, &quot;***&quot;)\r\n\t\/\/ \u4ef6\u540d\r\n\tsubject := &quot;Go\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3063\u305f\u30e1\u30fc\u30eb\u9001\u4fe1&quot;\r\n\t\/\/ \u672c\u6587:\u30c6\u30ad\u30b9\u30c8\u30d1\u30fc\u30c8\r\n\tplain := &quot;\u69cb\u9020\u3055\u3093\\r\\n\u304a\u5143\u6c17\u3067\u3059\u304b\u3002&quot;\r\n\t\/\/ \u672c\u6587:HTML\u30d1\u30fc\u30c8\r\n\thtml := `&lt;!DOCTYPE html PUBLIC &quot;-\/\/W3C\/\/DTD XHTML 1.0 Strict\/\/EN&quot; &quot;http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-strict.dtd&quot;&gt;\r\n&lt;html xmlns=&quot;http:\/\/www.w3.org\/1999\/xhtml&quot;&gt;\r\n&lt;head&gt;\r\n    &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text\/html; charset=utf-8&quot;&gt;\r\n    &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1&quot;&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;p&gt;\u69cb\u9020\u3055\u3093&lt;\/p&gt;\r\n    &lt;p&gt;\u304a\u5143\u6c17\u3067\u3059\u304b\u3002&lt;\/p&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;`\r\n\tmsg := mail.NewSingleEmail(from, subject, to, plain, html)\r\n\r\n\t\/\/ \u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u53d6\u5f97\r\n\tfmt.Println(&quot;----- \u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u6a19\u6e96\u51fa\u529b\u3059\u308b -----&quot;)\r\n\trequestBody := mail.GetRequestBody(msg)\r\n\t\/\/ JSON\u306e\u6574\u5f62\u3068\u51fa\u529b\r\n\tprettyJSON, err := json.MarshalIndent(json.RawMessage(requestBody), &quot;&quot;, &quot;  &quot;)\r\n\tif err != nil {\r\n\t\tfmt.Println(&quot;JSON\u6574\u5f62\u30a8\u30e9\u30fc:&quot;, err)\r\n\t\treturn\r\n\t}\r\n\tfmt.Println(string(prettyJSON))\r\n\r\n\t# \u30e1\u30fc\u30eb\u306e\u9001\u4fe1\r\n\tclient := sendgrid.NewSendClient(os.Getenv(&quot;SENDGRID_API_KEY&quot;))\r\n\tresp, err := client.Send(msg)\r\n\t# \u30a8\u30e9\u30fc\u51e6\u7406\r\n\tif err != nil {\r\n        fmt.Println(&quot;=== ERROR ===&quot;)\r\n        fmt.Println(err)\r\n        return\r\n\t}\r\n\r\n\tfmt.Println(&quot;----- \u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u6a19\u6e96\u51fa\u529b\u3059\u308b -----&quot;)\r\n\tfmt.Println(&quot;\\n=== RESPONSE STATUS ===&quot;)\r\n\tfmt.Println(resp.StatusCode)\r\n\r\n\tfmt.Println(&quot;\\n=== RESPONSE BODY ===&quot;)\r\n\tfmt.Println(resp.Body)\r\n\r\n\tfmt.Println(&quot;\\n=== RESPONSE HEADERS ===&quot;)\r\n\tfor key, values := range resp.Headers {\r\n\t\tfmt.Printf(&quot;%s: %s\\n&quot;, key, values)\r\n\t}\r\n}\t\r\n<\/pre>\n<p>sendgrid.env\u30d5\u30a1\u30a4\u30eb\u306b\u306f\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u3067\u4f5c\u6210\u3057\u305fAPI\u30ad\u30fc\u3092\u5b9a\u7fa9\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nexport SENDGRID_API_KEY=SG.xxxxxxxxxxxxxxxxxxxxxxxxx\r\n<\/pre>\n<p>\u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u3068\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u53d6\u5f97\u3059\u308b\u90e8\u5206\u3092\u8a73\u3057\u304f\u307f\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3>\u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u53d6\u5f97\u65b9\u6cd5<\/h3>\n<p>\u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u306f\u6b21\u306e\u65b9\u6cd5\u3067\u53d6\u5f97\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n\r\n\/\/ \u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u53d6\u5f97\r\nfmt.Println(&quot;----- \u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u6a19\u6e96\u51fa\u529b\u3059\u308b -----&quot;)\r\nrequestBody := mail.GetRequestBody(msg)\r\n\/\/ JSON\u306e\u6574\u5f62\r\nprettyJSON, err := json.MarshalIndent(json.RawMessage(requestBody), &quot;&quot;, &quot;  &quot;)\r\nif err != nil {\r\n\tfmt.Println(&quot;JSON\u6574\u5f62\u30a8\u30e9\u30fc:&quot;, err)\r\n\treturn\r\n}\r\n\/\/ JSON\u306e\u51fa\u529b\r\nfmt.Println(string(prettyJSON))\r\n\r\n<\/pre>\n<p>json.MarshalIndent\u3084json.RawMessage\u30e1\u30bd\u30c3\u30c9\u3067\u6574\u5f62\u3057\u3066\u51fa\u529b\u3059\u308b\u3068\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\r\n{\r\n  &quot;from&quot;: {\r\n    &quot;name&quot;: &quot;\u69cb\u9020\u592a\u90ce&quot;,\r\n    &quot;email&quot;: &quot;kentaro-ichimura@kentaroichimura.com&quot;\r\n  },\r\n  &quot;subject&quot;: &quot;Go\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3063\u305f\u30e1\u30fc\u30eb\u9001\u4fe1&quot;,\r\n  &quot;personalizations&quot;: &#x5B;\r\n    {\r\n      &quot;to&quot;: &#x5B;\r\n        {\r\n          &quot;name&quot;: &quot;\u69cb\u9020\u82b1\u5b50&quot;,\r\n          &quot;email&quot;: &quot;kentaro-ichimura@kke.co.jp&quot;\r\n        }\r\n      ]\r\n    }\r\n  ],\r\n  &quot;content&quot;: &#x5B;\r\n    {\r\n      &quot;type&quot;: &quot;text\/plain&quot;,\r\n      &quot;value&quot;: &quot;\u69cb\u9020\u3055\u3093\\r\\n\u304a\u5143\u6c17\u3067\u3059\u304b\u3002&quot;\r\n    },\r\n    {\r\n      &quot;type&quot;: &quot;text\/html&quot;,\r\n      &quot;value&quot;: &quot;\\u003c!DOCTYPE html PUBLIC \\&quot;-\/\/W3C\/\/DTD XHTML 1.0 Strict\/\/EN\\&quot; \\&quot;http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-strict.dtd\\&quot;\\u003e\\n\\u003chtml xmlns=\\&quot;http:\/\/www.w3.org\/1999\/xhtml\\&quot;\\u003e\\n\\u003chead\\u003e\\n    \\u003cmeta http-equiv=\\&quot;Content-Type\\&quot; content=\\&quot;text\/html; charset=utf-8\\&quot;\\u003e\\n    \\u003cmeta name=\\&quot;viewport\\&quot; content=\\&quot;width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1\\&quot;\\u003e\\n\\u003c\/head\\u003e\\n\\u003cbody\\u003e\\n    \\u003cp\\u003e\u69cb\u9020\u3055\u3093\\u003c\/p\\u003e\\n    \\u003cp\\u003e\u304a\u5143\u6c17\u3067\u3059\u304b\u3002\\u003c\/p\\u003e\\n\\u003c\/body\\u003e\\n\\u003c\/html\\u003e&quot;\r\n    }\r\n  ]\r\n}\r\n\r\n\r\n<\/pre>\n<p>\u7d9a\u3044\u3066\u3001\u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<h3>\u30ec\u30b9\u30dd\u30f3\u30b9\u306e\u53d6\u5f97\u65b9\u6cd5<\/h3>\n<p>\u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u306b\u5bfe\u3059\u308b\u30ec\u30b9\u30dd\u30f3\u30b9\u306f\u6b21\u306e\u65b9\u6cd5\u3067\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n\r\nresp, err := client.Send(msg)\r\n# \u30a8\u30e9\u30fc\u51e6\u7406\r\nif err != nil {\r\n        fmt.Println(&quot;=== ERROR ===&quot;)\r\n        fmt.Println(err)\r\n        return\r\n}\r\n\r\nfmt.Println(&quot;----- \u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u6a19\u6e96\u51fa\u529b\u3059\u308b -----&quot;)\r\nfmt.Println(&quot;\\n=== RESPONSE STATUS ===&quot;)\r\nfmt.Println(resp.StatusCode)\r\n\r\nfmt.Println(&quot;\\n=== RESPONSE BODY ===&quot;)\r\nfmt.Println(resp.Body)\r\n\r\nfmt.Println(&quot;\\n=== RESPONSE HEADERS ===&quot;)\r\nfor key, values := range resp.Headers {\r\n\tfmt.Printf(&quot;%s: %s\\n&quot;, key, values)\r\n\r\n<\/pre>\n<p>\u539f\u56e0\u3092\u7279\u5b9a\u3059\u308b\u969b\u3001\u7279\u306b\u5927\u4e8b\u306a\u306e\u306f\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c9\u3068\u30dc\u30c7\u30a3\u306e\u60c5\u5831\u3067\u3059\u3002\u6b63\u5e38\u5fdc\u7b54\uff08\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c9\u304c2xx\u7cfb\uff09\u3067\u3042\u308c\u3070\u3001SendGrid\u306b\u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u304c\u5c4a\u3044\u3066\u3044\u307e\u3059\u3002\u30ec\u30b9\u30dd\u30f3\u30b9\u304c\u30a8\u30e9\u30fc\u306e\u5834\u5408\uff08\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c9\u304c2xx\u7cfb\u4ee5\u5916\uff09\u306f\u3001SendGrid\u306b\u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u304c\u5c4a\u3044\u3066\u3044\u306a\u3044\u3001\u3082\u3057\u304f\u306f\u53d7\u3051\u4ed8\u3051\u3089\u308c\u3066\u3044\u306a\u3044\u306e\u3067\u3001body\u306e\u300cerrors\u300d\u3067\u793a\u3055\u308c\u305f\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u3082\u3068\u306b\u539f\u56e0\u3092\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3>\u6b63\u5e38\u5fdc\u7b54\u306e\u5834\u5408<\/h3>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n\r\n----- \u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u6a19\u6e96\u51fa\u529b\u3059\u308b -----\r\n\r\n=== RESPONSE STATUS ===\r\n202\r\n\r\n=== RESPONSE BODY ===\r\n\r\n\r\n=== RESPONSE HEADERS ===\r\nDate: &#x5B;Wed, 08 Oct 2025 11:33:13 GMT]\r\nX-Message-Id: &#x5B;1FYDZv75TQimZ5llrutXIw]\r\nAccess-Control-Allow-Origin: &#x5B;https:\/\/sendgrid.api-docs.io]\r\nAccess-Control-Allow-Headers: &#x5B;Authorization, Content-Type, On-behalf-of, x-sg-elas-acl]\r\nAccess-Control-Max-Age: &#x5B;600]\r\nReferrer-Policy: &#x5B;strict-origin-when-cross-origin]\r\nServer: &#x5B;nginx]\r\nContent-Length: &#x5B;0]\r\nStrict-Transport-Security: &#x5B;max-age=31536000; includeSubDomains]\r\nContent-Security-Policy: &#x5B;frame-ancestors 'none']\r\nCache-Control: &#x5B;no-cache]\r\nX-Content-Type-Options: &#x5B;no-sniff]\r\nConnection: &#x5B;keep-alive]\r\nAccess-Control-Allow-Methods: &#x5B;POST]\r\nX-No-Cors-Reason: &#x5B;https:\/\/sendgrid.com\/docs\/Classroom\/Basics\/API\/cors.html]\r\n\r\n<\/pre>\n<h3>\u30a8\u30e9\uff0d\u306e\u5834\u5408\uff08\u6b63\u3057\u304f\u306a\u3044\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u5f62\u5f0f\u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\uff09<\/h3>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n\r\n----- \u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u6a19\u6e96\u51fa\u529b\u3059\u308b -----\r\n\r\n=== RESPONSE STATUS ===\r\n400\r\n\r\n=== RESPONSE BODY ===\r\n{&quot;errors&quot;:&#x5B;{&quot;message&quot;:&quot;Does not contain a valid address.&quot;,&quot;field&quot;:&quot;personalizations.0.to.0.email&quot;,&quot;help&quot;:&quot;http:\/\/sendgrid.com\/docs\/API_Reference\/Web_API_v3\/Mail\/errors.html#message.personalizations.to&quot;}]}\r\n\r\n=== RESPONSE HEADERS ===\r\nContent-Length: &#x5B;204]\r\nAccess-Control-Allow-Headers: &#x5B;Authorization, Content-Type, On-behalf-of, x-sg-elas-acl]\r\nAccess-Control-Max-Age: &#x5B;600]\r\nContent-Security-Policy: &#x5B;frame-ancestors 'none']\r\nAccess-Control-Allow-Methods: &#x5B;POST]\r\nServer: &#x5B;nginx]\r\nContent-Type: &#x5B;application\/json]\r\nAccess-Control-Allow-Origin: &#x5B;https:\/\/sendgrid.api-docs.io]\r\nX-No-Cors-Reason: &#x5B;https:\/\/sendgrid.com\/docs\/Classroom\/Basics\/API\/cors.html]\r\nStrict-Transport-Security: &#x5B;max-age=31536000; includeSubDomains]\r\nReferrer-Policy: &#x5B;strict-origin-when-cross-origin]\r\nDate: &#x5B;Fri, 10 Oct 2025 06:46:50 GMT]\r\nConnection: &#x5B;keep-alive]\r\nCache-Control: &#x5B;no-cache]\r\nX-Content-Type-Options: &#x5B;no-sniff]\r\n\r\n\r\n<\/pre>\n<h3>\u30a8\u30e9\uff0d\u306e\u5834\u5408\uff08\u7121\u52b9\u306a\u8a8d\u8a3c\u60c5\u5831\u304c\u6307\u5b9a\u3055\u308c\u305f\u5834\u5408\uff09<\/h3>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n\r\n----- \u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u6a19\u6e96\u51fa\u529b\u3059\u308b -----\r\n\r\n=== RESPONSE STATUS ===\r\n401\r\n\r\n=== RESPONSE BODY ===\r\n{&quot;errors&quot;:&#x5B;{&quot;message&quot;:&quot;The provided authorization grant is invalid, expired, or revoked&quot;,&quot;field&quot;:null,&quot;help&quot;:null}]}\r\n\r\n=== RESPONSE HEADERS (\u6574\u5f62\u6e08) ===\r\nServer: &#x5B;nginx]\r\nContent-Length: &#x5B;116]\r\nAccess-Control-Allow-Origin: &#x5B;https:\/\/sendgrid.api-docs.io]\r\nX-No-Cors-Reason: &#x5B;https:\/\/sendgrid.com\/docs\/Classroom\/Basics\/API\/cors.html]\r\nContent-Type: &#x5B;application\/json]\r\nConnection: &#x5B;keep-alive]\r\nAccess-Control-Max-Age: &#x5B;600]\r\nStrict-Transport-Security: &#x5B;max-age=31536000; includeSubDomains]\r\nContent-Security-Policy: &#x5B;frame-ancestors 'none']\r\nCache-Control: &#x5B;no-cache]\r\nDate: &#x5B;Wed, 08 Oct 2025 11:45:08 GMT]\r\nAccess-Control-Allow-Methods: &#x5B;POST]\r\nAccess-Control-Allow-Headers: &#x5B;Authorization, Content-Type, On-behalf-of, x-sg-elas-acl]\r\nX-Content-Type-Options: &#x5B;no-sniff]\r\nReferrer-Policy: &#x5B;strict-origin-when-cross-origin]\r\n\r\n<\/pre>\n<p>\u30ec\u30b9\u30dd\u30f3\u30b9\u3067\u30a8\u30e9\u30fc\u304c\u8fd4\u3055\u308c\u305f\u5834\u5408\u306f\u3001\u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u306b\u8aa4\u308a\u304c\u306a\u3044\u304b\u3069\u3046\u304b\u78ba\u8a8d\u3057\u307e\u3057\u3087\u3046\u3002SendGrid\u304c\u7528\u610f\u3059\u308b<a href=\"https:\/\/www.twilio.com\/docs\/sendgrid\/for-developers\/sending-email\/sandbox-mode\" rel=\"noopener\" target=\"_blank\">Sandbox\u30e2\u30fc\u30c9<\/a>\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u5b9f\u969b\u306b\u30e1\u30fc\u30eb\u9001\u4fe1\u3092\u884c\u3046\u3053\u3068\u306a\u304f\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u304c\u6b63\u3057\u3044\u304b\u3069\u3046\u304b\u306e\u691c\u8a3c\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: cpp; title: ; notranslate\" title=\"\">\r\n\r\nmsg := mail.NewSingleEmail(from, subject, to, plain, html)\r\n\r\n\u2026\r\n\r\n\/\/ ----------------------------------------------------\r\n\/\/ \u3053\u3053\u3067Sandbox\u30e2\u30fc\u30c9\u3092\u6709\u52b9\u306b\u3059\u308b\u8a2d\u5b9a\u3092\u8ffd\u52a0\r\n\/\/ ----------------------------------------------------\r\n\r\nms := mail.NewMailSettings()\r\nms.SandboxMode = &amp;mail.Setting{\r\nEnable: func(b bool) *bool { return &amp;b }(true),\r\n}\r\nmsg.SetMailSettings(ms)\r\n\/\/ ----------------------------------------------------\r\n\r\n\u2026\r\n\r\n# \u30e1\u30fc\u30eb\u306e\u9001\u4fe1\r\nclient := sendgrid.NewSendClient(os.Getenv(&quot;SENDGRID_API_KEY&quot;))\r\nresp, err := client.Send(msg)\r\n# \u30a8\u30e9\u30fc\u51e6\u7406\r\nif err != nil {\r\nfmt.Println(&quot;=== ERROR ===&quot;)\r\nfmt.Println(err)\r\nreturn\r\n}\r\n\r\nfmt.Println(&quot;----- \u30ec\u30b9\u30dd\u30f3\u30b9\u3092\u6a19\u6e96\u51fa\u529b\u3059\u308b -----&quot;)\r\nfmt.Println(&quot;\\n=== RESPONSE STATUS ===&quot;)\r\nfmt.Println(resp.StatusCode)\r\n\r\nfmt.Println(&quot;\\n=== RESPONSE BODY ===&quot;)\r\nfmt.Println(resp.Body)\r\n\r\nfmt.Println(&quot;\\n=== RESPONSE HEADERS ===&quot;)\r\nfor key, values := range resp.Headers {\r\n\tfmt.Printf(&quot;%s: %s\\n&quot;, key, values)\r\n\r\n<\/pre>\n<p>\u30ea\u30af\u30a8\u30b9\u30c8\u306f\u6b63\u5e38\u306b\u53d7\u3051\u4ed8\u3051\u3089\u308c\u305f\u304c\u30e1\u30fc\u30eb\u3078\u306e<a href=\"https:\/\/sendgrid.kke.co.jp\/docs\/Tutorials\/A_Transaction_Mail\/send_with_substitution.html\" rel=\"noopener\" target=\"_blank\">\u5dee\u3057\u8fbc\u307f<\/a>\u304c\u3046\u307e\u304f\u3044\u304b\u306a\u3044\u3001\u6307\u5b9a\u3057\u305f<a href=\"https:\/\/sendgrid.kke.co.jp\/docs\/Tutorials\/A_Transaction_Mail\/using_dynamic_templates.html\" rel=\"noopener\" target=\"_blank\">\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8<\/a>\u304c\u53cd\u6620\u3055\u308c\u306a\u3044\u306a\u3069\u3001\u304a\u56f0\u308a\u306e\u5834\u5408\u306f\u3001\u5f0a\u793e\u30b5\u30dd\u30fc\u30c8\u30c1\u30fc\u30e0\u304c\u30d5\u30a9\u30ed\u30fc\u3044\u305f\u3057\u307e\u3059\u3002\u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u3068\u30ec\u30b9\u30dd\u30f3\u30b9\u3001\u53d7\u4fe1\u30e1\u30fc\u30eb\u3092\u6dfb\u3048\u3066<a href=\"https:\/\/support.sendgrid.kke.co.jp\/hc\/ja\/requests\/new\" rel=\"noopener\" target=\"_blank\">\u304a\u554f\u3044\u5408\u308f\u305b<\/a>\u304f\u3060\u3055\u3044\u3002<\/p>\n<h3>\u30b3\u30fc\u30c9\u306e\u518d\u78ba\u8a8d\u3092\u3057\u307e\u3057\u3087\u3046<\/h3>\n<p>SendGrid\u3067\u306f\u9001\u4fe1\u5f8c\u306e\u72b6\u6cc1\u3092Activity\u3084Event Webhook\u3067\u78ba\u8a8d\u3067\u304d\u308b\u305f\u3081\u3001\u305d\u306e\u624b\u524d\u306e\u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u3084\u30ec\u30b9\u30dd\u30f3\u30b9\u306e\u30ed\u30b0\u51fa\u529b\u3092\u5fd8\u308c\u304c\u3061\u3067\u3059\u3002\u4eca\u56de\u306e\u30d6\u30ed\u30b0\u3092\u304d\u3063\u304b\u3051\u306b\u3001\u3057\u3063\u304b\u308a\u30ed\u30b0\u51fa\u529b\u3067\u304d\u3066\u3044\u308b\u304b\u3054\u81ea\u8eab\u306e\u30b3\u30fc\u30c9\u3092\u3082\u3046\u4e00\u5ea6\u898b\u76f4\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30e1\u30fc\u30eb\u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u5b9f\u884c\u3057\u305f\u306e\u306b\u3001Activity\u3084Event Webhook\u306b\u30a4\u30d9\u30f3\u30c8\u304c\u8a18\u9332\u3055\u308c\u3066\u3044\u306a\u3044\uff01\u3068\u3044\u3046\u7d4c\u9a13\u306f\u3042\u308a\u307e\u305b\u3093\u304b\uff1f\u30a4\u30d9\u30f3\u30c8\u304c\u767a\u751f\u3057\u306a\u3044\u4e3b\u306a\u539f\u56e0\u3068\u3057\u3066\u3001Twilio SendGrid\u306b\u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u304c <a class=\"read-more\" href=\"https:\/\/sendgrid.kke.co.jp\/blog\/?p=19609\">&#8230;\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":2,"featured_media":19610,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11,8],"tags":[],"class_list":["post-19609","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technical","category-product"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/19609","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19609"}],"version-history":[{"count":6,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/19609\/revisions"}],"predecessor-version":[{"id":19617,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/19609\/revisions\/19617"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/media\/19610"}],"wp:attachment":[{"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19609"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}