{"id":12390,"date":"2020-03-24T12:02:00","date_gmt":"2020-03-24T03:02:00","guid":{"rendered":"https:\/\/sendgrid.kke.co.jp\/blog\/?p=12390"},"modified":"2026-04-09T15:01:02","modified_gmt":"2026-04-09T06:01:02","slug":"javascript-node-js%e3%81%8b%e3%82%89sendgrid%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%92%e9%80%81%e4%bf%a1%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/sendgrid.kke.co.jp\/blog\/?p=12390","title":{"rendered":"JavaScript\/Node.js\u304b\u3089SendGrid\u3092\u4f7f\u3063\u3066\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-12391\" src=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2020\/03\/Screen_Shot_2019-05-07_at_3.58.18_PM.width-808.png\" alt=\"JavaScript\/Node.js\u304b\u3089SendGrid\u3092\u4f7f\u3063\u3066\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3059\u308b\u65b9\u6cd5\" width=\"100%\" srcset=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2020\/03\/Screen_Shot_2019-05-07_at_3.58.18_PM.width-808.png 808w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2020\/03\/Screen_Shot_2019-05-07_at_3.58.18_PM.width-808-300x98.png 300w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2020\/03\/Screen_Shot_2019-05-07_at_3.58.18_PM.width-808-768x251.png 768w\" sizes=\"(max-width: 808px) 100vw, 808px\" \/><\/p>\n<blockquote><p>\u3053\u306e\u8a18\u4e8b\u306f <a href=\"https:\/\/www.twilio.com\/blog\/how-to-send-emails-in-javascript-with-sendgrid\" target=\"_blank\" rel=\"noopener\">How to Send Emails in JavaScript\/Node.js with SendGrid<\/a> \u306e\u6284\u8a33\u3067\u3059\u3002<\/p><\/blockquote>\n<p>Node.js\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u958b\u767a\u3057\u3066\u3044\u308b\u3068\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u304b\u3089\u30e1\u30fc\u30eb\u9001\u4fe1\u3059\u308b\u5fc5\u8981\u306b\u8feb\u3089\u308c\u308b\u3053\u3068\u304c\u3042\u308b\u3067\u3057\u3087\u3046\u3002<a href=\"https:\/\/sendgrid.kke.co.jp\/docs\/API_Reference\/Web_API_v3\/Mail\/index.html\" target=\"_blank\" rel=\"noopener\">Twilio SendGrid\u306e\u30e1\u30fc\u30eb\u9001\u4fe1API<\/a>\u306f\u3053\u306e\u8ab2\u984c\u3092\u89e3\u6c7a\u3057\u3066\u304f\u308c\u307e\u3059\u3002\u65e2\u306bSendGrid\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u6301\u3063\u3066\u3044\u3066\u3001API\u30ad\u30fc\u304c<a href=\"https:\/\/www.twilio.com\/blog\/2017\/01\/how-to-set-environment-variables.html\" target=\"_blank\" rel=\"noopener\">\u74b0\u5883\u5909\u6570<\/a>\u306b\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308c\u3070\u3001\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3060\u3051\u3067JavaScript\u3067\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3067\u304d\u307e\u3059\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nconst sgMail = require(&#039;@sendgrid\/mail&#039;);\nsgMail.setApiKey(process.env.SENDGRID_API_KEY);\nconst msg = {\n to: test@example.com&#039;,\n from: &#039;test@example.com&#039;,\n subject: &#039;Sending with SendGrid is Fun&#039;,\n text: &#039;and easy to do anywhere, even with Node.js&#039;,\n html: &#039;&lt;strong&gt;and easy to do anywhere, even with Node.js&lt;\/strong&gt;&#039;,\n};\nsgMail.send(msg);\n<\/pre>\n<p>\u305d\u308c\u3067\u306f\u4e00\u3064\u305a\u3064\u9806\u3092\u8ffd\u3063\u3066\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n<h3>\u958b\u767a\u74b0\u5883\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7<\/h3>\n<p>\u3053\u306e\u8a18\u4e8b\u306e\u5185\u5bb9\u3092\u9032\u3081\u308b\u306b\u306f\u4ee5\u4e0b\u306e\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u304c\u5fc5\u8981\u3067\u3059\u3002\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\uff1a<\/p>\n<table border>\n<tr>\n<td>\n\u30fb<a href=\"https:\/\/nodejs.org\/en\/#download\" target=\"_blank\" rel=\"noopener\">Node.js\u3068npm<\/a>\uff08\u6700\u521d\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304f\u3060\u3055\u3044\uff09<br \/>\n\u30fb<a href=\"https:\/\/sendgrid.kke.co.jp\/app?p=signup.index\" target=\"_blank\" rel=\"noopener\">SendGrid\u30a2\u30ab\u30a6\u30f3\u30c8<\/a><br \/>\n\u30fb<a href=\"https:\/\/github.com\/sendgrid\/sendgrid-nodejs\" target=\"_blank\" rel=\"noopener\">SendGrid Node\u30e9\u30a4\u30d6\u30e9\u30ea<\/a><\/li>\n<\/td>\n<\/tr>\n<\/table>\n<p>Node.js\u3067Web\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u958b\u767a\u3059\u308b\u306e\u3067\u3042\u308c\u3070\u3001\u958b\u767a\u74b0\u5883\u3092\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u3059\u308b\u306e\u306b<a href=\"https:\/\/www.twilio.com\/docs\/usage\/tutorials\/how-to-set-up-your-node-js-and-express-development-environment\" target=\"_blank\" rel=\"noopener\">\u3053\u3061\u3089\u306e\u30ac\u30a4\u30c9<\/a>\u3082\u53c2\u8003\u306b\u306a\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n<h3>SendGrid\u3078\u306e\u30b5\u30a4\u30f3\u30a2\u30c3\u30d7\u3068API\u30ad\u30fc\u306e\u4f5c\u6210<\/h3>\n<p>\u7d9a\u3044\u3066\u3001<a href=\"https:\/\/sendgrid.kke.co.jp\/app?p=signup.index\" target=\"_blank\" rel=\"noopener\">SendGrid\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u4f5c\u6210<\/a>\u3057\u307e\u3057\u3087\u3046\u3002\u3053\u306e\u8a18\u4e8b\u306e\u5185\u5bb9\u3092\u9032\u3081\u308b\u3060\u3051\u3067\u3042\u308c\u3070\u7121\u6599\u30c8\u30e9\u30a4\u30a2\u30eb\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u3067\u5341\u5206\u3067\u3059\u3002\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u4f5c\u6210\u3057\u305f\u3089\u3001\u4ee5\u4e0b\u306e\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\u306e\u3088\u3046\u306b<a href=\"https:\/\/sendgrid.kke.co.jp\/docs\/Tutorials\/A_Transaction_Mail\/manage_api_key.html\" target=\"_blank\" rel=\"noopener\">API\u30ad\u30fc\u3092\u4f5c\u6210<\/a>\u3057\u3066\u304f\u3060\u3055\u3044\u3002API\u30ad\u30fc\u540d\u306f\u4f55\u3067\u3082\u69cb\u3044\u307e\u305b\u3093\u3002API\u30ad\u30fc\u3092\u4f5c\u6210\u3057\u305f\u3089\u753b\u9762\u3092\u9589\u3058\u308b\u524d\u306b\u305d\u306e\u5185\u5bb9\u3092\u3069\u3053\u304b\u306b\u4fdd\u5b58\u3057\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\uff01<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-12394\" src=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2020\/03\/lNYouLpXHeCk7rL6vlzkda1nQ3QiowPtfBZ_5_2O_5D6l_.width-500.png\" alt=\"API\u30ad\u30fc\u306e\u4f5c\u6210\" width=\"100%\" srcset=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2020\/03\/lNYouLpXHeCk7rL6vlzkda1nQ3QiowPtfBZ_5_2O_5D6l_.width-500.png 500w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2020\/03\/lNYouLpXHeCk7rL6vlzkda1nQ3QiowPtfBZ_5_2O_5D6l_.width-500-300x202.png 300w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2020\/03\/lNYouLpXHeCk7rL6vlzkda1nQ3QiowPtfBZ_5_2O_5D6l_.width-500-225x150.png 225w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/p>\n<p>API\u30ad\u30fc\u306f\u74b0\u5883\u5909\u6570\u306b\u4fdd\u5b58\u3059\u308b\u3068\u826f\u3044\u3067\u3057\u3087\u3046\u3002JavaScript\u306e\u30b3\u30fc\u30c9\u306b\u76f4\u63a5API\u30ad\u30fc\u3092\u66f8\u304f\u5fc5\u8981\u304c\u306a\u304f\u306a\u308a\u307e\u3059\u3002\u74b0\u5883\u5909\u6570 <span style=\"background-color:#d3d3d3\">SENDGRID_API_KEY<\/span> \u306b\u5148\u307b\u3069\u4f5c\u6210\u3057\u305fAPI\u30ad\u30fc\u3092\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u74b0\u5883\u5909\u6570\u306e\u4f7f\u3044\u65b9\u306b\u3064\u3044\u3066\u306f<a href=\"https:\/\/www.twilio.com\/blog\/2017\/01\/how-to-set-environment-variables.html\" target=\"_blank\" rel=\"noopener\">\u3053\u3061\u3089\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb<\/a>\u304c\u53c2\u8003\u306b\u306a\u308a\u307e\u3059\u3002\u8a2d\u5b9a\u3057\u305f\u74b0\u5883\u5909\u6570\u306f\u3053\u306e\u5f8c\u3067\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n<h3>Node.js\u3067\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3059\u308b<\/h3>\n<p>SendGrid\u30a2\u30ab\u30a6\u30f3\u30c8\u3068API\u30ad\u30fc\u306e\u6e96\u5099\u304c\u3067\u304d\u305f\u3089\u3001\u3044\u3088\u3044\u3088\u30b3\u30fc\u30c9\u3092\u66f8\u3044\u3066\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3057\u307e\u3059\uff01\u30bf\u30fc\u30df\u30ca\u30eb\uff08\u30b3\u30de\u30f3\u30c9\u30d7\u30ed\u30f3\u30d7\u30c8\uff09\u3092\u958b\u3044\u3066\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u5b9f\u884c\u3059\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\u3057\u305f\u3089\u3001<span style=\"background-color:#d3d3d3\">package.json<\/span>\u30d5\u30a1\u30a4\u30eb\u3092\u751f\u6210\u3059\u308b\u305f\u3081\u306b\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306fnpm\u304c\u4f9d\u5b58\u95a2\u4fc2\u3092\u89e3\u6c7a\u3059\u308b\u305f\u3081\u306e\u3082\u306e\u3067\u3059\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nnpm init --yes\n<\/pre>\n<p>Node.js\u5411\u3051\u306eSendGrid\u30d8\u30eb\u30d1\u30fc\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nnpm install @sendgrid\/mail\n<\/pre>\n<p>\u3053\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306b<span style=\"background-color:#d3d3d3\">index.js<\/span>\u3068\u3044\u3046\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u307e\u3059\uff1a<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nconst sgMail = require(&#039;@sendgrid\/mail&#039;);\nsgMail.setApiKey(process.env.SENDGRID_API_KEY);\nconst msg = {\n to: test@example.com&#039;,\n from: &#039;test@example.com&#039;,\n subject: &#039;Sending with SendGrid is Fun&#039;,\n text: &#039;and easy to do anywhere, even with Node.js&#039;,\n html: &#039;&lt;strong&gt;and easy to do anywhere, even with Node.js&lt;\/strong&gt;&#039;,\n};\nsgMail.send(msg);\n<\/pre>\n<p><span style=\"background-color:#d3d3d3\">SENDGRID_API_KEY<\/span>\u74b0\u5883\u5909\u6570\u306bAPI\u30ad\u30fc\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u304b\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u305d\u3057\u3066\u3001\u30b3\u30fc\u30c9\u304c\u671f\u5f85\u901a\u308a\u52d5\u4f5c\u3059\u308b\u3053\u3068\u3092\u78ba\u8a8d\u3059\u308b\u305f\u3081\u306b\u3001\u5909\u6570<span style=\"background-color:#d3d3d3\">to<\/span>\u3092\u3054\u81ea\u8eab\u306e\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306b\u7f6e\u304d\u63db\u3048\u307e\u3059\u3002<\/p>\n<p>\u6700\u5f8c\u306b\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u30e1\u30fc\u30eb\u3092\u9001\u3063\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nnode index.js\n<\/pre>\n<p>\u53d7\u4fe1\u30c8\u30ec\u30a4\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u30e1\u30fc\u30eb\u304c\u5c4a\u3044\u3066\u3044\u308b\u306f\u305a\u3067\u3059\uff01<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2020\/03\/0QIMQvOWsDoRW8GkDP1FFAmUjqv4zCwMs1HHqsb48nE3YM.width-500.png\" alt=\"\u30e1\u30fc\u30eb\u53d7\u4fe1\" width=\"100%\" class=\"aligncenter size-full wp-image-12398\" srcset=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2020\/03\/0QIMQvOWsDoRW8GkDP1FFAmUjqv4zCwMs1HHqsb48nE3YM.width-500.png 500w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2020\/03\/0QIMQvOWsDoRW8GkDP1FFAmUjqv4zCwMs1HHqsb48nE3YM.width-500-300x90.png 300w\" sizes=\"(max-width: 500px) 100vw, 500px\" \/><\/p>\n<h3>\u6b21\u306e\u30b9\u30c6\u30c3\u30d7\u306f\uff1f<\/h3>\n<p>Node.js\u304b\u3089\u7c21\u5358\u306a\u30e1\u30fc\u30eb\u9001\u4fe1\u304c\u3067\u304d\u308b\u3053\u3068\u306f\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u304c\u3001\u6b21\u306b\u884c\u3044\u305f\u3044\u3053\u3068\u306f\u4f55\u3067\u3057\u3087\u3046\u304b?\u4f8b\u3048\u3070\u3001<a href=\"https:\/\/sendgrid.kke.co.jp\/docs\/API_Reference\/Webhooks\/parse.html\" rel=\"noopener\" target=\"_blank\">Inbound Parse Webhook<\/a>\u3092\u5229\u7528\u3059\u308b\u3068\u3001\u53d7\u4fe1\u30e1\u30fc\u30eb\u3092\u51e6\u7406\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4ed6\u306b\u3082\u305f\u304f\u3055\u3093\u306e\u6a5f\u80fd\u304c\u3042\u308b\u306e\u3067\u3001\u305c\u3072<a href=\"https:\/\/sendgrid.kke.co.jp\/docs\/Tutorials\/index.html\" rel=\"noopener\" target=\"_blank\">\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a>\u3092\u30c1\u30a7\u30c3\u30af\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u306e\u8a18\u4e8b\u306f How to Send Emails in JavaScript\/Node.js with SendGrid \u306e\u6284\u8a33\u3067\u3059\u3002 Node.js\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u958b\u767a\u3057\u3066\u3044\u308b\u3068\u3001\u30d7\u30ed\u30b0\u30e9\u30e0\u304b\u3089\u30e1\u30fc\u30eb\u9001\u4fe1\u3059\u308b\u5fc5\u8981\u306b <a class=\"read-more\" href=\"https:\/\/sendgrid.kke.co.jp\/blog\/?p=12390\">&#8230;\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":2,"featured_media":12391,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11],"tags":[],"class_list":["post-12390","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technical"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/12390","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=12390"}],"version-history":[{"count":37,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/12390\/revisions"}],"predecessor-version":[{"id":20589,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/12390\/revisions\/20589"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/media\/12391"}],"wp:attachment":[{"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12390"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12390"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12390"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}