{"id":16069,"date":"2022-12-01T11:30:47","date_gmt":"2022-12-01T02:30:47","guid":{"rendered":"https:\/\/sendgrid.kke.co.jp\/blog\/?p=16069"},"modified":"2022-12-01T16:07:55","modified_gmt":"2022-12-01T07:07:55","slug":"quarkus-mailer%e3%81%a7twilio-sendgrid%e3%81%ae%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%92%e9%80%81%e4%bf%a1%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/sendgrid.kke.co.jp\/blog\/?p=16069","title":{"rendered":"Quarkus Mailer\u3067Twilio SendGrid\u306e\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3059\u308b"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/e42fde0c088725ab75d6f99dfb584a6e.png\" alt=\"Quarkus Mailer\u3067Twilio SendGrid\u306e\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3059\u308b\" width=\"100%\" class=\"aligncenter size-full wp-image-16077\" srcset=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/e42fde0c088725ab75d6f99dfb584a6e.png 650w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/e42fde0c088725ab75d6f99dfb584a6e-300x185.png 300w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/p>\n<p>SendGrid\u30b5\u30dd\u30fc\u30c8\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u83ca\u7530(<a href=\"https:\/\/twitter.com\/kikutaro_\" rel=\"noopener\" target=\"_blank\">@kikutaro_<\/a>)\u3067\u3059\u3002\u5148\u65e5\u3001Java\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e1\u3064\u3067\u3042\u308b<a href=\"https:\/\/quarkus.io\/\" rel=\"noopener\" target=\"_blank\">Quarkus<\/a>\u3092\u8abf\u3079\u3066\u3044\u305f\u3068\u3053\u308d\u3001<a href=\"https:\/\/ja.quarkus.io\/guides\/mailer-reference.html\" rel=\"noopener\" target=\"_blank\">Quarkus Mailer<\/a>\u3068\u3044\u3046\u30a8\u30af\u30b9\u30c6\u30f3\u30b7\u30e7\u30f3\u304c\u3042\u308b\u3053\u3068\u3092\u77e5\u308a\u307e\u3057\u305f\u3002\u65e9\u901fTwilio SendGrid\u306e\u30e1\u30fc\u30eb\u3092\u9001\u3063\u3066\u307f\u305f\u306e\u3067\u624b\u9806\u3092\u307e\u3068\u3081\u307e\u3059\u3002<\/p>\n<h3>Quarkus\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3059\u308b<\/h3>\n<p>Quarkus\u306f\u30b3\u30f3\u30c6\u30ca\u74b0\u5883\u306e\u52d5\u4f5c\u306b\u6700\u9069\u5316\u3055\u308c\u305f\u30aa\u30fc\u30d7\u30f3\u30bd\u30fc\u30b9\u306eJava\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u3067\u3059\u3002Red Hat\u304c\u4e3b\u5c0e\u3057\u3066\u3044\u3066\u3001<a href=\"https:\/\/ja.quarkus.io\/\" rel=\"noopener\" target=\"_blank\">\u65e5\u672c\u8a9e\u7248\u306e\u30b5\u30a4\u30c8<\/a>\u3082\u516c\u958b\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306e\u30bb\u30c3\u30c8\u30a2\u30c3\u30d7\u306f\u3068\u3066\u3082\u7c21\u5358\u3067\u3059\u3002<a href=\"https:\/\/code.quarkus.io\/\" rel=\"noopener\" target=\"_blank\">https:\/\/code.quarkus.io\/<\/a> \u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u4f7f\u3044\u305f\u3044\u30a8\u30af\u30b9\u30c6\u30f3\u30b7\u30e7\u30f3\u3092\u9078\u3076\u3068\u3001Maven\u3084Gradle\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3057\u3066\u304f\u308c\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/1.png\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/1.png\" alt=\"Quarkus\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\" width=\"100%\" class=\"aligncenter size-full wp-image-16072\" srcset=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/1.png 1884w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/1-300x152.png 300w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/1-768x388.png 768w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/1-1024x517.png 1024w\" sizes=\"(max-width: 1884px) 100vw, 1884px\" \/><\/a><\/p>\n<p>\u4eca\u56de\u306e\u30d6\u30ed\u30b0\u3067\u306f\u3001Web\u30d5\u30a9\u30fc\u30e0\u306b\u5165\u529b\u3057\u305f\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306b\u901a\u77e5\u3092\u9001\u308b<a href=\"https:\/\/github.com\/kikutaro\/QuarkusMailerSendGrid\" rel=\"noopener\" target=\"_blank\">\u30b5\u30f3\u30d7\u30eb<\/a>\u3092\u4f5c\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/2.png\" alt=\"Web\u30d5\u30a9\u30fc\u30e0\u306b\u5165\u529b\u3057\u305f\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u306b\u901a\u77e5\u3092\u9001\u308b\u30b5\u30f3\u30d7\u30eb\" width=\"100%\" class=\"aligncenter size-full wp-image-16073\" srcset=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/2.png 1041w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/2-300x137.png 300w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/2-768x350.png 768w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/2-1024x466.png 1024w\" sizes=\"(max-width: 1041px) 100vw, 1041px\" \/><\/p>\n<p>\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306fMaven\u3092\u9078\u3073\u3001\u30a8\u30af\u30b9\u30c6\u30f3\u30b7\u30e7\u30f3\u306f\u300cQuarkus Mailer\u300d\u306e\u4ed6\u3001Web API\u3092\u4f5c\u6210\u3059\u308b\u300cRESTEasy Reactive\u300d\u3092\u9078\u629e\u3057\u307e\u3057\u305f\u3002<\/p>\n<p>\u306a\u304a\u3001\u79c1\u306e\u958b\u767a\u74b0\u5883\u306fUbuntu 22.04 LTS(Jammy Jellyfish)\u3067JDK\u306fEclipse Temurin 19.0.1+10\u3067\u3059\u3002<\/p>\n<aside>\n\u958b\u767a\u74b0\u5883\u306bQuarkus CLI\u304c\u5165\u3063\u3066\u3044\u306a\u3044\u5834\u5408\u306f<a href=\"https:\/\/ja.quarkus.io\/guides\/cli-tooling\" rel=\"noopener\" target=\"_blank\">\u3053\u3061\u3089<\/a>\u3092\u53c2\u8003\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u304f\u3060\u3055\u3044\u3002\u79c1\u306fUbuntu\u4e0a\u3067\u4ee5\u4e0b\u3092\u5b9f\u884c\u3057\u307e\u3057\u305f\u3002<br \/>\n<br \/>\ncurl &#45;Ls https:\/\/sh.jbang.dev | bash &#45;s &#45; trust add https:\/\/repo1.maven.org\/maven2\/io\/quarkus\/quarkus-cli\/<br \/>\ncurl &#45;Ls https:\/\/sh.jbang.dev | bash &#45;s &#45; app install &#45;&#45;fresh &#45;&#45;force quarkus@quarkusio<br \/>\n<\/aside>\n<p>\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nquarkus dev\r\n<\/pre>\n<p><a href=\"http:\/\/localhost:8080\/\" rel=\"noopener\" target=\"_blank\">http:\/\/localhost:8080\/<\/a> \u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u6b21\u306e\u30da\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u305f\u3089\u6e96\u5099\u5b8c\u4e86\u3067\u3059\u3002<\/p>\n<p><a href=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/3.png\" target=\"_blank\"><img decoding=\"async\" src=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/3.png\" alt=\"\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u305f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3092\u5b9f\u884c\" width=\"100%\" class=\"aligncenter size-full wp-image-16074\" srcset=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/3.png 1487w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/3-300x163.png 300w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/3-768x416.png 768w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/3-1024x555.png 1024w\" sizes=\"(max-width: 1487px) 100vw, 1487px\" \/><\/a><\/p>\n<h3>Quarkus Mailer\u306b\u3088\u308b\u9001\u4fe1<\/h3>\n<p>\u6700\u521d\u306b\u3001<a href=\"https:\/\/support.sendgrid.kke.co.jp\/hc\/ja\/articles\/204187885\" rel=\"noopener\" target=\"_blank\">SendGrid\u306eSMTP\u63a5\u7d9a\u60c5\u5831<\/a>\u3092application.properties\u30d5\u30a1\u30a4\u30eb\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002quarkus.mailer.password\u306e\u90e8\u5206\u306b\u306f<a href=\"https:\/\/sendgrid.kke.co.jp\/docs\/Tutorials\/A_Transaction_Mail\/manage_api_key.html\" rel=\"noopener\" target=\"_blank\">SendGrid\u306e\u30a2\u30ab\u30a6\u30f3\u30c8\u3067\u767a\u884c\u3057\u305fAPI\u30ad\u30fc<\/a>\u3001quarkus.mailer.from\u306b\u306f\u9001\u4fe1\u5143\u306e\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u8a2d\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nquarkus.mailer.host=smtp.sendgrid.net\r\nquarkus.mailer.port=587\r\nquarkus.mailer.username=apikey\r\nquarkus.mailer.password=SG.xxxxxxxxxxxxxxxxxxxx\r\nquarkus.mailer.login=REQUIRED\r\nquarkus.mailer.from=kikutaro@kikutaro.tech\r\n\r\nquarkus.mailer.mock=false # In dev mode, prevent from using the mock SMTP server\r\n<\/pre>\n<p>\u5b9f\u88c5\u306f\u30b7\u30f3\u30d7\u30eb\u3067\u3059\u3002POST\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u30dc\u30c7\u30a3\u306b\u6307\u5b9a\u3055\u308c\u305f\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u5b9b\u3066\u306b\u30e1\u30fc\u30eb\u3092\u9001\u308a\u307e\u3059\u3002<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npackage tech.kikutaro;\r\n\r\nimport io.quarkus.mailer.Mail;\r\nimport io.quarkus.mailer.Mailer;\r\n\r\nimport javax.ws.rs.POST;\r\nimport javax.ws.rs.Path;\r\nimport javax.ws.rs.Produces;\r\nimport javax.ws.rs.core.MediaType;\r\nimport javax.inject.Inject;\r\nimport org.jboss.resteasy.reactive.RestForm;\r\n\r\n@Path(&quot;\/form&quot;)\r\npublic class FormResource {\r\n    @Inject Mailer mailer;\r\n\r\n    @POST\r\n    @Produces(MediaType.TEXT_PLAIN)\r\n    public String form(@RestForm String email) {\r\n\r\n        mailer.send(Mail.withText(email, &quot;\u30e1\u30eb\u30de\u30ac\u8cfc\u8aad\u306e\u767b\u9332\u5b8c\u4e86&quot;, &quot;\u767b\u9332\u3044\u305f\u3060\u304d\u3001\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3057\u305f\u3002&quot;));\r\n\r\n        return &quot;\u767b\u9332\u3092\u53d7\u3051\u4ed8\u3051\u307e\u3057\u305f\u3002\u30e1\u30fc\u30eb\u3092\u3054\u78ba\u8a8d\u304f\u3060\u3055\u3044\u3002&quot;;\r\n    }\r\n}\r\n<\/pre>\n<p>HTML\u306e\u30d5\u30a9\u30fc\u30e0\u3092\u7528\u610f\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">\r\n &lt;form action=&quot;form&quot; method=&quot;post&quot; enctype=&quot;multipart\/form-data&quot;&gt;\r\n    &lt;input type=&quot;email&quot; name=&quot;email&quot; placeholder=&quot;Email&quot; \/&gt;\r\n    &lt;button&gt;\u9001\u4fe1&lt;\/button&gt;\r\n &lt;\/form&gt;\r\n<\/pre>\n<p>\u30e1\u30fc\u30eb\u30a2\u30c9\u30ec\u30b9\u3092\u5165\u529b\u3057\u3066\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u3068\u3001Quarkus Mailer\u3092\u4f7f\u3063\u3066SendGrid\u304b\u3089\u306e\u30e1\u30fc\u30eb\u304c\u9001\u3089\u308c\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/4.png\" alt=\"Quarkus Mailer\u3092\u4f7f\u3063\u3066SendGrid\u304b\u3089\u9001\u3089\u308c\u305f\u30e1\u30fc\u30eb\" width=\"100%\" class=\"aligncenter size-full wp-image-16075\" srcset=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/4.png 708w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2022\/11\/4-300x169.png 300w\" sizes=\"(max-width: 708px) 100vw, 708px\" \/><\/p>\n<p>Quarkus Mailer\u306e\u6a5f\u80fd\u306f\u307e\u305f\u5225\u306e\u30d6\u30ed\u30b0\u3067\u7d39\u4ecb\u3057\u3066\u3044\u3053\u3046\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SendGrid\u30b5\u30dd\u30fc\u30c8\u30a8\u30f3\u30b8\u30cb\u30a2\u306e\u83ca\u7530(@kikutaro_)\u3067\u3059\u3002\u5148\u65e5\u3001Java\u306e\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\u306e1\u3064\u3067\u3042\u308bQuarkus\u3092\u8abf\u3079\u3066\u3044\u305f\u3068\u3053\u308d\u3001Quarkus Mailer\u3068\u3044\u3046\u30a8\u30af\u30b9\u30c6\u30f3\u30b7\u30e7\u30f3\u304c\u3042\u308b\u3053\u3068\u3092\u77e5\u308a\u307e\u3057\u305f\u3002 <a class=\"read-more\" href=\"https:\/\/sendgrid.kke.co.jp\/blog\/?p=16069\">&#8230;\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":9,"featured_media":16077,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11],"tags":[],"class_list":["post-16069","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\/16069","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\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=16069"}],"version-history":[{"count":5,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/16069\/revisions"}],"predecessor-version":[{"id":16080,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/16069\/revisions\/16080"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/media\/16077"}],"wp:attachment":[{"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=16069"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=16069"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=16069"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}