{"id":13982,"date":"2021-05-28T14:02:40","date_gmt":"2021-05-28T05:02:40","guid":{"rendered":"https:\/\/sendgrid.kke.co.jp\/blog\/?p=13982"},"modified":"2026-03-12T14:39:29","modified_gmt":"2026-03-12T05:39:29","slug":"inbound-parse-webhook%e3%81%a8php%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%9f-%e8%bf%94%e4%bf%a1%e5%8f%af%e8%83%bd%e3%81%aa%e3%83%a1%e3%83%bc%e3%83%ab%e3%81%ae%e4%bd%9c%e6%88%90","status":"publish","type":"post","link":"https:\/\/sendgrid.kke.co.jp\/blog\/?p=13982","title":{"rendered":"Inbound Parse Webhook\u3068PHP\u3092\u4f7f\u3063\u305f \u8fd4\u4fe1\u53ef\u80fd\u306a\u30e1\u30fc\u30eb\u306e\u4f5c\u6210"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture0.png\" alt=\"Inbound Parse Webhook\u3068PHP\u3092\u4f7f\u3063\u305f\u8fd4\u4fe1\u53ef\u80fd\u306a\u30e1\u30fc\u30eb\u306e\u4f5c\u6210\" width=\"100%\" class=\"aligncenter size-full wp-image-13983 noshadow\" srcset=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture0.png 1129w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture0-300x186.png 300w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture0-768x476.png 768w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture0-1024x635.png 1024w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture0-592x366.png 592w\" sizes=\"(max-width: 1129px) 100vw, 1129px\" \/><\/p>\n<p>SendGrid\u30b5\u30dd\u30fc\u30c8\u30c1\u30fc\u30e0\u306e\u9752\u6728\u3067\u3059\u3002<\/p>\n<p>\u7686\u3055\u3093\u3001<span style=\"background-color:#d3d3d3;\">noreply@example.com<\/span>\u306e\u3088\u3046\u306a\u30a2\u30c9\u30ec\u30b9\u304b\u3089\u30e1\u30fc\u30eb\u3092\u53d7\u3051\u53d6\u3063\u305f\u3053\u3068\u306f\u3042\u308a\u307e\u3059\u3067\u3057\u3087\u3046\u304b\u3002\u3053\u306e\u3088\u3046\u306a\u30a2\u30c9\u30ec\u30b9\u304b\u3089\u306e\u30e1\u30fc\u30eb\u306b\u5bfe\u3057\u3066\u306f\u3001\u591a\u304f\u306e\u5834\u5408\u3001\u6587\u5b57\u901a\u308a\u8fd4\u4fe1\u306f\u3067\u304d\u306a\u3044\u306e\u3067\u306f\u306a\u3044\u304b\u3068\u601d\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<p>\u8fd4\u4fe1\u4e0d\u53ef\u306e\u30e1\u30fc\u30eb\u3092\u9001\u308b\u306e\u306f\u3001\u4e00\u65b9\u7684\u306a\u30b3\u30df\u30e5\u30cb\u30b1\u30fc\u30b7\u30e7\u30f3\u3068\u306a\u308b\u305f\u3081\u3001\u30e1\u30fc\u30eb\u8cfc\u8aad\u8005\u3068\u9001\u4fe1\u8005\u306e\u53cc\u65b9\u306b\u3068\u3063\u3066\u597d\u307e\u3057\u304f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<blockquote><p>\u8fd4\u4fe1\u4e0d\u53ef\u30e1\u30fc\u30eb\u304c\u671b\u307e\u308c\u306a\u3044\u7406\u7531\u306e\u8a73\u7d30\u306f\u3001<a href=\"https:\/\/sendgrid.kke.co.jp\/blog\/?p=10848\" rel=\"noopener\" target=\"_blank\">\u3053\u3061\u3089\u306e\u8a18\u4e8b<\/a>\u3067\u7d39\u4ecb\u3057\u3066\u3044\u307e\u3059\uff01<\/p><\/blockquote>\n<p>\u53ef\u80fd\u3067\u3042\u308c\u3070\u3001\u30e1\u30fc\u30eb\u306f\u8fd4\u4fe1\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002SendGrid\u306b\u306f\u30e1\u30fc\u30eb\u3092\u53d7\u4fe1\u3059\u308b\u305f\u3081\u306e<a href=\"https:\/\/sendgrid.kke.co.jp\/docs\/User_Manual_JP\/Settings\/parse.html\" rel=\"noopener\" target=\"_blank\">Inbound Parse Webhook<\/a>\u3068\u3044\u3046\u6a5f\u80fd\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u6a5f\u80fd\u3092\u5229\u7528\u3059\u308b\u3068\u3082\u3057\u8fd4\u4fe1\u304c\u3042\u3063\u305f\u3068\u304d\u306b\u3082\u53d7\u3051\u53d6\u308b\u3053\u3068\u304c\u53ef\u80fd\u3067\u3059\uff01<\/p>\n<p>\u4eca\u56de\u306f\u3001Twilio\u306e\u30d6\u30ed\u30b0\u300c<a href=\"https:\/\/www.twilio.com\/blog\/create-transactional-emails-reply-to-php-twilio-sendgrid-inbound-parse\" rel=\"noopener\" target=\"_blank\">Create Transactional Emails you can Reply to in PHP with Twilio SendGrid Inbound Parse<\/a>\u300d\u3067\u53d6\u308a\u4e0a\u3052\u3089\u308c\u305f\u3001Inbound Parse Webhook\u3092\u4f7f\u3063\u305f\u8fd4\u4fe1\u53ef\u80fd\u306a\u30c8\u30e9\u30f3\u30b6\u30af\u30b7\u30e7\u30f3\u30e1\u30fc\u30eb\u306e\u4f5c\u6210\u65b9\u6cd5\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u307e\u3059\uff01<\/p>\n<h3>\u4eca\u56de\u5b9f\u88c5\u3059\u308b\u6a5f\u80fd\u306b\u3064\u3044\u3066<\/h3>\n<p>Inbound Parse Webhook\u306f\u3001\u6307\u5b9a\u3057\u305f\u30c9\u30e1\u30a4\u30f3\u306b\u9001\u3089\u308c\u3066\u304d\u305f\u30e1\u30fc\u30eb\u3092SendGrid\u304c\u53d7\u4fe1\u3057\u3066\u3001\u305d\u306e\u5185\u5bb9\u3092\u6307\u5b9a\u3057\u305fURL\u3078POST\u3059\u308b\u6a5f\u80fd\u3067\u3059\u3002\u4eca\u56de\u306f\u3001\u30e6\u30fc\u30b6\u304b\u3089\u306e\u8fd4\u4fe1\u3092Inbound Parse Webhook\u3067\u53d7\u4fe1\u3057\u3066\u3001\u81ea\u52d5\u7684\u306b\u8fd4\u4fe1\u3059\u308b\u6a5f\u80fd\u3092\u5b9f\u88c5\u3057\u307e\u3059\u3002<br \/>\n\u69cb\u7bc9\u3059\u308b\u6a5f\u80fd\u306e\u8a73\u7d30\u3092\u4e0b\u306e\u56f3\u306b\u793a\u3057\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture1.png\" alt=\"\u30e6\u30fc\u30b6\u304b\u3089\u306e\u8fd4\u4fe1\u3092Inbound Parse Webhook\u3067\u53d7\u4fe1\u3057\u3066\u3001\u81ea\u52d5\u7684\u306b\u8fd4\u4fe1\u3059\u308b\u6a5f\u80fd\" width=\"100%\" class=\"aligncenter size-full wp-image-13984 noshadow\" srcset=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture1.png 1943w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture1-300x92.png 300w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture1-768x235.png 768w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture1-1024x314.png 1024w\" sizes=\"(max-width: 1943px) 100vw, 1943px\" \/><\/p>\n<ol>\n<li><span style=\"background-color:#d3d3d3;\">Email.php<\/span>\u3092\u5b9f\u884c\u3057\u3001SendGrid\u3078\u30e1\u30fc\u30eb\u9001\u4fe1\u3092\u30ea\u30af\u30a8\u30b9\u30c8\u3059\u308b<\/li>\n<li>\u672c\u6587\u306b\u300c#Another one\u300d\u3068\u66f8\u3044\u3066\u3001\u30e6\u30fc\u30b6\u304c\u30e1\u30fc\u30eb\u3092\u8fd4\u4fe1\u3059\u308b<\/li>\n<li>Inbound Parse Webhook\u306e\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8URL\u306bPOST\u3055\u308c\u305f\u30e1\u30fc\u30eb\u306e\u5185\u5bb9\u3092<span style=\"background-color:#d3d3d3;\">Webhook.php<\/span>\u3067\u53d7\u3051\u3001\u8fd4\u4fe1\u30e1\u30fc\u30eb\u3092\u69cb\u7bc9\u3057\u3066\u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u3059\u308b<\/li>\n<li>\u30e6\u30fc\u30b6\u304c\u30e1\u30fc\u30eb\u3092\u53d7\u4fe1\u3059\u308b<\/li>\n<\/ol>\n<h3>\u5fc5\u8981\u306a\u3082\u306e<\/h3>\n<ul>\n<li><a href=\"https:\/\/app.sendgrid.com\/login?redirect_to=%2F\" rel=\"noopener\" target=\"_blank\">SendGrid\u30a2\u30ab\u30a6\u30f3\u30c8<\/a><\/li>\n<li><a href=\"https:\/\/www.php.net\/manual\/ja\/install.php\" rel=\"noopener\" target=\"_blank\">PHP<\/a><\/li>\n<li><a href=\"https:\/\/getcomposer.org\/doc\/00-intro.md\" rel=\"noopener\" target=\"_blank\">Composer<\/a><\/li>\n<li><a href=\"https:\/\/ngrok.com\/download\" rel=\"noopener\" target=\"_blank\">ngrok<\/a><\/li>\n<li>\u30c9\u30e1\u30a4\u30f3\uff08<a href=\"https:\/\/www.freenom.com\/ja\/index.html\" rel=\"noopener\" target=\"_blank\">Freenom<\/a>\u3001<a href=\"https:\/\/www.onamae.com\/\" rel=\"noopener\" target=\"_blank\">\u304a\u540d\u524d.com<\/a>\u306a\u3069\u3067\u53d6\u5f97\uff09<\/li>\n<\/ul>\n<p>SendGrid\u306f<a href=\"https:\/\/support.sendgrid.kke.co.jp\/hc\/ja\/articles\/204906155\" rel=\"noopener\" target=\"_blank\">\u7121\u6599\u30c8\u30e9\u30a4\u30a2\u30eb<\/a>\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u3067\u69cb\u3044\u307e\u305b\u3093\u3002<br \/>\n\u79c1\u306e\u958b\u767a\u74b0\u5883\u3067\u306f\u3001PHP (7.3.11)\u3068Composer (2.0.13)\u3001ngrok (2.3.35)\u3092\u4f7f\u3044\u307e\u3057\u305f\u3002<\/p>\n<h3>\u624b\u9806<\/h3>\n<h4>Step 1: \u958b\u767a\u74b0\u5883\u306e\u69cb\u7bc9<\/h4>\n<p>\u958b\u767a\u7528\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u4f5c\u6210\u3057\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306b\u6b21\u306e3\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li>Webhook.php<\/li>\n<li>Email.php<\/li>\n<li>.env<\/li>\n<\/ul>\n<p>\u4ee5\u4e0b\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n$ mkdir SendGrid &amp;amp;&amp;amp; cd SendGrid\n$ touch Webhook.php Email.php .env\n<\/pre>\n<h4>Step 2: \u4f9d\u5b58\u95a2\u4fc2\u306e\u89e3\u6c7a<\/h4>\n<p>\u958b\u767a\u7528\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\u3057\u3001\u6b21\u306e2\u3064\u306e\u4f9d\u5b58\u30bd\u30d5\u30c8\u30a6\u30a7\u30a2\u3092Composer\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/vlucas\/phpdotenv\" rel=\"noopener\" target=\"_blank\">PHP Dotenv<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/sendgrid\/sendgrid-php\" rel=\"noopener\" target=\"_blank\">SendGrid \u516c\u5f0fPHP\u30e9\u30a4\u30d6\u30e9\u30ea<\/a><\/li>\n<\/ul>\n<p>\u5b9f\u884c\u3059\u308b\u30b3\u30de\u30f3\u30c9\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n$ composer require vlucas\/phpdotenv sendgrid\/sendgrid\n<\/pre>\n<h4>Step 3: SendGrid API\u30ad\u30fc\u306e\u4f5c\u6210<\/h4>\n<p><a href=\"https:\/\/app.sendgrid.com\/login?redirect_to=%2Fsettings%2Fapi_keys\" rel=\"noopener\" target=\"_blank\">SendGrid\u306e\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9<\/a>\u306b\u79fb\u52d5\u3057\u3001<a href=\"https:\/\/sendgrid.kke.co.jp\/docs\/Tutorials\/A_Transaction_Mail\/manage_api_key.html#-Generate\" rel=\"noopener\" target=\"_blank\">API\u30ad\u30fc\u3092\u4f5c\u6210<\/a>\u3057\u307e\u3057\u3087\u3046\u3002<br \/>\n\u4f5c\u6210\u3059\u308bAPI\u30ad\u30fc\u306e\u6a29\u9650\u306f\u3001Inbound Parse\u3068Mail Send\u306e\u307fFull Access\u3067\u5341\u5206\u3067\u3059\u3002<span style=\"background-color:#d3d3d3;\">.env<\/span>\u30d5\u30a1\u30a4\u30eb\u306b\u4ee5\u4e0b\u306e\u901a\u308a\u5165\u529b\u3057\u3001\u74b0\u5883\u5909\u6570\u3068\u3057\u3066API\u30ad\u30fc\u3092\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\nSENDGRID_API_KEY=&amp;quot;INSERT YOUR API KEY HERE&amp;quot;\n<\/pre>\n<h4>Step 4: \u30e1\u30fc\u30eb\u9001\u4fe1\u7528\u30b3\u30fc\u30c9\u306e\u6e96\u5099<\/h4>\n<p><span style=\"background-color:#d3d3d3;\">Email.php<\/span>\u306b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\n&amp;lt;?php\nrequire &#039;vendor\/autoload.php&#039;;\n\n\/\/ Load our `.env` variables\n$dotenv = Dotenv\\Dotenv::createImmutable(__DIR__);\n$dotenv-&amp;gt;load();\n\n\/\/ Declare a new SendGrid Mail object\n$email = new \\SendGrid\\Mail\\Mail();\n\n\/\/ Set the email parameters\n$email-&amp;gt;setFrom(&amp;quot;sales@yourdomain&amp;quot;, &amp;quot;Daisuke Aoki&amp;quot;);\n$email-&amp;gt;setSubject(&amp;quot;Order #456557&amp;quot;);\n$email-&amp;gt;addTo(&amp;quot;customer@example.com&amp;quot;, &amp;quot;Daisuke Aoki&amp;quot;);\n$email-&amp;gt;addContent(&amp;quot;text\/plain&amp;quot;, &amp;quot;Thank you for the purchase! If you need to\nmake another order of this item, respond to this email with the text \u2018#Another one\u2019.&amp;quot;);\n\n$sendgrid = new \\SendGrid($_ENV&#x5B;&#039;SENDGRID_API_KEY&#039;]);\n\n\/\/ Send the email\ntry {\n\n  $response = $sendgrid-&amp;gt;send($email);\n   print $response-&amp;gt;statusCode() . &amp;quot;\\n&amp;quot;;\n   print_r($response-&amp;gt;headers());\n   print $response-&amp;gt;body() . &amp;quot;\\n&amp;quot;;\n   echo &amp;quot;email sent!\\n&amp;quot;;\n\n} catch (Exception $e) {\n   echo &#039;Caught exception: &#039;. $e-&amp;gt;getMessage() .&amp;quot;\\n&amp;quot;;\n}\n<\/pre>\n<p><span style=\"background-color:#d3d3d3;\">Email.php<\/span>\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u5546\u54c1\u306e\u6ce8\u6587\u78ba\u8a8d\u306e\u30e1\u30fc\u30eb\u304c\u300114\u884c\u76ee\u306e<span style=\"background-color:#d3d3d3;\">addTo<\/span>\u3067\u6307\u5b9a\u3057\u305f\u5b9b\u5148\u306b\u5c4a\u304d\u307e\u3059\u300212\u884c\u76ee\u306e<span style=\"background-color:#d3d3d3;\">setFrom<\/span>\u306e\u9001\u4fe1\u5143\u30a2\u30c9\u30ec\u30b9\u306b\u306f\u3001Inbound Parse Webhook\u3092\u8a2d\u5b9a\u3057\u305f\u30c9\u30e1\u30a4\u30f3\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<h4>Step 5: Inbound Parse Webhook\u306e\u8a2d\u5b9a<\/h4>\n<p>Inbound Parse Webhook\u3092\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u6307\u5b9a\u3057\u305f\u30c9\u30e1\u30a4\u30f3\u3067\u30e1\u30fc\u30eb\u3092\u53d7\u4fe1\u3057\u3001\u53d7\u4fe1\u3057\u305f\u30e1\u30fc\u30eb\u306e\u5185\u5bb9\u3092\u304a\u597d\u304d\u306aURL\u306bPOST\u3059\u308b\u3053\u3068\u304c\u53ef\u80fd\u3068\u306a\u308a\u307e\u3059\u3002\u307e\u305a\u306f\u3001ngrok\u3092\u4f7f\u3063\u3066\u3001\u30e1\u30fc\u30eb\u306ePOST\u5148\u3068\u306a\u308bURL\u3092\u4f5c\u6210\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<blockquote><p>ngrok\u3092\u4f7f\u3046\u3053\u3068\u306b\u3088\u308a\u3001\u624b\u5143\u306e\u74b0\u5883\u3067Inbound Parse Webhook\u306e\u52d5\u4f5c\u78ba\u8a8d\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p><\/blockquote>\n<p>\u30b3\u30f3\u30bd\u30fc\u30eb\u753b\u9762\u4e0a\u3067\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n$ php -S localhost:3000\n<\/pre>\n<p>\u65b0\u3057\u3044\u30b3\u30f3\u30bd\u30fc\u30eb\u753b\u9762\u3092\u958b\u304d\u3001\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n$ ngrok http 3000\n<\/pre>\n<p>ngrok\u30b3\u30de\u30f3\u30c9\u306e\u5b9f\u884c\u7d50\u679c\u3068\u3057\u3066\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306aURL\u304c\u8868\u793a\u3055\u308c\u308b\u306f\u305a\u3067\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nhttps:\/\/XXXXXXXXXXXX.ngrok.io\n<\/pre>\n<p>ngrok\u306eURL\u306e\u6700\u5f8c\u306b<span style=\"background-color:#d3d3d3;\">\/webhook.php<\/span>\u3092\u4ed8\u3051\u8db3\u3057\u305f\u3082\u306e\u3092\u3001POST\u5148URL\u3068\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nhttps:\/\/XXXXXXXXXXXX.ngrok.io\/webhook.php\n<\/pre>\n<p>Inbound Parse Webhook\u306e\u8a2d\u5b9a\u5185\u5bb9\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<blockquote><p>\u8a2d\u5b9a\u65b9\u6cd5\u306e\u8a73\u7d30\u306b\u3064\u3044\u3066\u306f\u3001<a href=\"https:\/\/sendgrid.kke.co.jp\/docs\/Tutorials\/E_Receive_Mail\/receive_mail.html\" rel=\"noopener\" target=\"_blank\">\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb<\/a>\u3082\u3057\u304f\u306f<a href=\"https:\/\/sendgrid.kke.co.jp\/blog\/?p=12114\" rel=\"noopener\" target=\"_blank\">\u30d6\u30ed\u30b0\u8a18\u4e8b<\/a>\u3092\u3054\u89a7\u304f\u3060\u3055\u3044\u3002\u4f7f\u7528\u3059\u308b\u30c9\u30e1\u30a4\u30f3\u306e<a href=\"https:\/\/sendgrid.kke.co.jp\/docs\/Tutorials\/D_Improve_Deliverability\/using_whitelabel.html#-Domain-Whitelabel\" rel=\"noopener\" target=\"_blank\">Domain Authentication<\/a>\u3068<a href=\"https:\/\/sendgrid.kke.co.jp\/docs\/Tutorials\/E_Receive_Mail\/receive_mail.html#-Add-DNS-Record\" rel=\"noopener\" target=\"_blank\">MX\u30ec\u30b3\u30fc\u30c9\u306e\u8a2d\u5b9a<\/a>\u3092\u304a\u5fd8\u308c\u306a\u304f\uff01<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture2.png\" alt=\"Inbound Parse Webhook\u306e\u8a2d\u5b9a\" width=\"100%\" class=\"aligncenter size-full wp-image-13985 noshadow\" srcset=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture2.png 1200w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture2-300x272.png 300w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture2-768x696.png 768w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture2-1024x928.png 1024w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/p>\n<h4>Step 6: \u30e1\u30fc\u30eb\u8fd4\u4fe1\u7528\u30b3\u30fc\u30c9\u306e\u6e96\u5099<\/h4>\n<p>\u524d\u306e\u30b9\u30c6\u30c3\u30d7\u3067Inbound Parse Webhook\u306e\u8a2d\u5b9a\u304c\u5b8c\u4e86\u3057\u305f\u306e\u3067\u3001POST\u3055\u308c\u308b\u30e1\u30fc\u30eb\u306e\u5185\u5bb9\u304b\u3089\u8fd4\u4fe1\u30e1\u30fc\u30eb\u3092\u4f5c\u6210\u3059\u308b\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u3001<span style=\"background-color:#d3d3d3;\">Webhook.php<\/span>\u306b\u66f8\u304d\u8fbc\u307f\u307e\u3057\u3087\u3046\u3002<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\n&amp;lt;?php\n\nrequire &#039;vendor\/autoload.php&#039;;\n\n\/\/ Load our `.env` variable\n$dotenv = Dotenv\\Dotenv::createImmutable(__DIR__);\n$dotenv-&amp;gt;load();\n\n\/\/ Declare a new SendGrid Mail object\n$email = new \\SendGrid\\Mail\\Mail();\n\nif ($_SERVER&#x5B;&#039;REQUEST_METHOD&#039;] === &#039;POST&#039;) {\n\n    $from = $_POST&#x5B;&amp;quot;from&amp;quot;];\n    $body = $_POST&#x5B;&amp;quot;text&amp;quot;];\n    $subject = $_POST&#x5B;&amp;quot;subject&amp;quot;];\n\n    $body = explode(&amp;quot;\\n&amp;quot;, $body);\n\n    preg_match(&#039;#\\&amp;lt;(.*?)\\&amp;gt;#&#039;, $from, $match);\n    $fromEmail = $match&#x5B;1];\n\n    $name = explode(&amp;quot;&amp;lt;&amp;quot;, $from);\n\n    $order = explode(&amp;quot;:&amp;quot;, $subject);\n\n    \/\/ Remove a newline code from the String\n    $keyword = trim($body&#x5B;0]);\n\n    if (strcmp(strval($keyword), &amp;quot;#Another one&amp;quot;) == 0) {\n\n        \/\/ Set the email parameters\n        $email-&amp;gt;setFrom(&amp;quot;reorder@yourdomain&amp;quot;, &amp;quot;Daisuke Aoki&amp;quot;);\n        $email-&amp;gt;setSubject(&amp;quot;Another one!&amp;quot;);\n        $email-&amp;gt;addTo($fromEmail, $name&#x5B;0]);\n        $email-&amp;gt;addContent(&amp;quot;text\/plain&amp;quot;, &amp;quot;Thanks $name&#x5B;0], we have\n        made another dispatch for your previous order:$order&#x5B;1]&amp;quot;);\n\n        \/\/ Send the email\n        $sendgrid = new \\SendGrid($_ENV&#x5B;&#039;SENDGRID_API_KEY&#039;]);\n        $response = $sendgrid-&amp;gt;send($email);\n        \n    } else {\n\n        \/\/ error handling\n\n    }\n}\n<\/pre>\n<p>\u30e6\u30fc\u30b6\u304b\u3089\u306e\u8fd4\u4fe1\u30e1\u30fc\u30eb\u306b<span style=\"background-color:#d3d3d3;\">#Another one<\/span>\u304c\u542b\u307e\u308c\u3066\u3044\u305f\u5834\u5408\u300130\u884c\u76ee\u306eif\u6587\u306e\u6761\u4ef6\u5206\u5c90\u304ctrue\u3068\u306a\u308a\u3001\u300cAnother one!\u300d\u306e\u30bf\u30a4\u30c8\u30eb\u3067\u8ffd\u52a0\u6ce8\u6587\u306e\u78ba\u8a8d\u30e1\u30fc\u30eb\u304c\u4f5c\u6210\u3055\u308c\u3001\u30e6\u30fc\u30b6\u306b\u8fd4\u4fe1\u3055\u308c\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0a\u3067\u6e96\u5099\u306f\u5b8c\u4e86\u306a\u306e\u3067\u3001\u5b9f\u969b\u306b\u30e1\u30fc\u30eb\u3092\u9001\u3063\u3066\u307f\u307e\u3057\u3087\u3046\uff01<\/p>\n<h3>\u7d50\u679c<\/h3>\n<p>\u30b3\u30f3\u30bd\u30fc\u30eb\u753b\u9762\u3067\u6b21\u306e\u30b3\u30de\u30f3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u3001\u6700\u521d\u306e\u30e1\u30fc\u30eb\u3092\u9001\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n$ php Email.php\n<\/pre>\n<p>\u4ee5\u4e0b\u306e\u30e1\u30fc\u30eb\u3092\u53d7\u3051\u53d6\u308b\u306f\u305a\u3067\u3059\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture3.png\" alt=\"\u6700\u521d\u306e\u30e1\u30fc\u30eb\" width=\"100%\" class=\"aligncenter size-full wp-image-13986 noshadow\" srcset=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture3.png 1337w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture3-300x142.png 300w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture3-768x364.png 768w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture3-1024x485.png 1024w\" sizes=\"(max-width: 1337px) 100vw, 1337px\" \/><\/p>\n<p>\u30e1\u30fc\u30eb\u672c\u6587\u306b<span style=\"background-color:#d3d3d3;\">#Another one<\/span>\u3068\u66f8\u3044\u3066\u8fd4\u4fe1\u3057\u3066\u307f\u308b\u3068\u3001<br \/>\n<img decoding=\"async\" src=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture4.png\" alt=\"\u30e1\u30fc\u30eb\u672c\u6587\u306b#Another one\u3068\u66f8\u3044\u3066\u8fd4\u4fe1\" width=\"100%\" class=\"aligncenter size-full wp-image-13987 noshadow\" srcset=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture4.png 1333w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture4-300x234.png 300w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture4-768x600.png 768w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture4-1024x800.png 1024w\" sizes=\"(max-width: 1333px) 100vw, 1333px\" \/><\/p>\n<p>\u6b21\u306e\u3088\u3046\u306a\u30e1\u30fc\u30eb\u304c\u8fd4\u3063\u3066\u304f\u308b\u306f\u305a\u3067\u3059\uff01<br \/>\n<img decoding=\"async\" src=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture5.png\" alt=\"\u8fd4\u3063\u3066\u304f\u308b\u30e1\u30fc\u30eb\" width=\"100%\" class=\"aligncenter size-full wp-image-13988 noshadow\" srcset=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture5.png 1329w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture5-300x107.png 300w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture5-768x274.png 768w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2021\/05\/Picture5-1024x365.png 1024w\" sizes=\"(max-width: 1329px) 100vw, 1329px\" \/><\/p>\n<h3>\u307e\u3068\u3081<\/h3>\n<p>\u4eca\u56de\u306f\u3001Inbound Parse Webhook\u3092\u7528\u3044\u3066\u3001\u8fd4\u4fe1\u53ef\u80fd\u306a\u30e1\u30fc\u30eb\u3092\u9001\u3063\u3066\u307f\u307e\u3057\u305f\uff01\u3053\u306e\u6a5f\u80fd\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u30e1\u30fc\u30eb\u53d7\u4fe1\u3092\u30c8\u30ea\u30ac\u30fc\u306b\u3057\u305f\u6a5f\u80fd\u3092\u5b9f\u88c5\u3067\u304d\u307e\u3059\u3002Inbound Parse Webhook\u3092\u4f7f\u3063\u305f\u5b9f\u88c5\u306b\u3064\u3044\u3066\u3055\u3089\u306b\u8208\u5473\u306e\u3042\u308b\u65b9\u306f\u3001\u4ee5\u4e0b\u306e\u95a2\u9023\u8a18\u4e8b\u3082\u305c\u3072\u3054\u89a7\u304f\u3060\u3055\u3044\uff01<\/p>\n<h3>\u95a2\u9023\u8a18\u4e8b<\/h3>\n<ul>\n<li><a href=\"https:\/\/sendgrid.kke.co.jp\/blog\/?p=12114\" rel=\"noopener\" target=\"_blank\">SendGrid\u30d6\u30ed\u30b0 &#8211; SendGrid \u65b0\u4eba\u6210\u9577\u8a18\u3000\u7b2c\u4e03\u56de\u3000Inbound Parse Webhook\u3092\u7528\u3044\u3066\u30e1\u30fc\u30eb\u3092\u53d7\u4fe1\u3059\u308b<\/a><\/li>\n<li><a href=\"https:\/\/sendgrid.kke.co.jp\/blog\/?p=13367\" rel=\"noopener\" target=\"_blank\">SendGrid\u30d6\u30ed\u30b0 &#8211; SendGrid\u30fbTwilio\u30fbAWS Lambda\u3092\u4f7f\u3063\u3066\u30e1\u30fc\u30eb\u304b\u3089SMS\u3078\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u9001\u3063\u3066\u307f\u305f<\/a><\/li>\n<li><a href=\"https:\/\/sendgrid.kke.co.jp\/blog\/?p=7648\" rel=\"noopener\" target=\"_blank\">SendGrid\u30d6\u30ed\u30b0 &#8211; Node.js\u3068PhantomJS\u3092\u4f7f\u3063\u3066\u30e1\u30fc\u30eb\u53d7\u4fe1\u51e6\u7406\u3092\u81ea\u52d5\u5316\u3059\u308b\u65b9\u6cd5<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>SendGrid\u30b5\u30dd\u30fc\u30c8\u30c1\u30fc\u30e0\u306e\u9752\u6728\u3067\u3059\u3002 \u7686\u3055\u3093\u3001noreply@example.com\u306e\u3088\u3046\u306a\u30a2\u30c9\u30ec\u30b9\u304b\u3089\u30e1\u30fc\u30eb\u3092\u53d7\u3051\u53d6\u3063\u305f\u3053\u3068\u306f\u3042\u308a\u307e\u3059\u3067\u3057\u3087\u3046\u304b\u3002\u3053\u306e\u3088\u3046\u306a\u30a2\u30c9\u30ec\u30b9\u304b\u3089\u306e\u30e1\u30fc\u30eb\u306b\u5bfe\u3057\u3066\u306f\u3001\u591a\u304f\u306e\u5834\u5408\u3001\u6587\u5b57\u901a\u308a\u8fd4\u4fe1 <a class=\"read-more\" href=\"https:\/\/sendgrid.kke.co.jp\/blog\/?p=13982\">&#8230;\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":22,"featured_media":13983,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11],"tags":[],"class_list":["post-13982","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\/13982","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\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=13982"}],"version-history":[{"count":12,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/13982\/revisions"}],"predecessor-version":[{"id":20275,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/13982\/revisions\/20275"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/media\/13983"}],"wp:attachment":[{"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13982"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=13982"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=13982"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}