Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Rails 6.0 Action Mailboxについて
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
horikawa
May 15, 2019
Programming
0
400
Rails 6.0 Action Mailboxについて
otemachi.rb#17で発表した資料
horikawa
May 15, 2019
Tweet
Share
More Decks by horikawa
See All by horikawa
Caching associations in rails
casix
1
330
Create Action Mailbox Sample Application
casix
1
420
Rails 4.2→5.2アップデート
casix
0
450
Other Decks in Programming
See All in Programming
CDIの誤解しがちな仕様とその対処TIPS
futokiyo
0
220
Linux Kernelの1文字のミスで 権限昇格ができた話
rqda
0
1.8k
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
630
安いハードウェアでVulkan
fadis
0
520
技術検証結果の整理と解析をAIに任せよう!
keisukeikeda
0
130
Everything Claude Code OSS詳細 — 5層構造の中身と導入方法
targe
0
130
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
430
今からFlash開発できるわけないじゃん、ムリムリ! (※ムリじゃなかった!?)
arkw
0
110
Symfony + NelmioApiDocBundle を使った スキーマ駆動開発 / Schema Driven Development with NelmioApiDocBundle
okashoi
0
170
AWS×クラウドネイティブソフトウェア設計 / AWS x Cloud-Native Software Design
nrslib
16
3.3k
SourceGeneratorのマーカー属性問題について
htkym
0
200
Kubernetesでセルフホストが簡単なNewSQLを求めて / Seeking a NewSQL Database That's Simple to Self-Host on Kubernetes
nnaka2992
0
150
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
97
6.6k
Become a Pro
speakerdeck
PRO
31
5.8k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.8k
YesSQL, Process and Tooling at Scale
rocio
174
15k
Utilizing Notion as your number one productivity tool
mfonobong
4
260
Leadership Guide Workshop - DevTernity 2021
reverentgeek
1
240
Site-Speed That Sticks
csswizardry
13
1.1k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
790
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Transcript
Rails 6.0ͷ Action Mailbox גࣜձࣾπΫϧόɹαʔόαΠυΤϯδχΞ ງɹ@CASIXx1
• ීஈʮcowcamoʯͱ͍͏ΞϓϦΛ։ൃͯ͠ ·͢ • αʔόαΠυɺRailsʢ5.2ʣΛͬͯ·͢
Rails 6.0.0͕ͦΖͦΖग़ͦ͏ʂ
Rails 6.0.0.rc1͕ग़͍ͯΔͷ Ͱɺ΄΅6.0ͷػೳࢼͤΔʂ
৭ʑՃ͞Ε͍ͯΔ
Rails 6.0ͷओཁՃػೳ • Action Text • Action Mailbox • Multiple
Databases • Parallel Testing • Zeitwerk...etc
Action Textͷ ฉ͚͘Ͳɺɺ
Action Mailboxͷฉ͔ͳ͍...
Action Mailboxͷ͜ͱΛ ௐͯΈ·ͨ͠ ʢ·్ͩத·Ͱ͔͠ ࢼͤͯͳ͍ ʣ
ݩʑɺผͷgemͱ࣮ͯ͠͞Ε ͍ͯͨ
Rails 5.2Ͱ͑ͦ͏???
Action Mailboxͷػೳ • ड৴ϝʔϧʹରͯ͠ɺʮRailsʯͰɺॲཧ͢Δʂ • DBS3ʹอଘͨ͠ΓɺAction MailerΛͬͯɺ ࣗಈฦ৴ͨ͠Γ…
4FOE(SJE Ϣʔβʔ ϝʔϧૹ৴ RailsʹHTTP Post ɹ3BJMT "DUJPO.BJMCPY ॲཧ %# อଘ
4
ॳظઃఆ • $ rails action_mailbox:install • ApplicationMailboxΫϥε͕ੜ͞ΕΔ • MailboxΛ֨ೲ͢Δςʔϒϧ͕ੜ͞ΕΔ
app/mailboxes/application_mailbox.rb class ApplicationMailbox < ActionMailbox::Base #
[email protected]
Ѽͷϝʔϧ # ForwardsMailboxΫϥεͰɺॲཧΛߦ͏ routing
/^save@/i => :forwards #
[email protected]
Ѽͷϝʔϧ # RepliesMailboxΫϥεͰɺॲཧΛߦ͏ routing /@replies\./i => :replies end
ϝʔϧɺInboundEmailϞσ ϧͱͯ͠ѻΘΕΔ • class InboundEmail < ActiveRecord::Base • https://github.com/rails/rails/blob/ master/actionmailbox/app/models/
action_mailbox/inbound_email.rb • ActiveStorageͱࣅͨΑ͏ͳײ͡??
SMTPड͚ೖΕઃఆ • config/environments/֤ڥ.rb config.action_mailbox.ingress = # ͜͜ʹαʔϏε໊ # sendgridͷ߹ config.action_mailbox.ingress
= :sendgrid # mailgunͷ߹ config.action_mailbox.ingress = :mailgun # exam, mailgun, mandrill, postfix, postmark, qmail, sendgridΛαϙʔτ͍ͯ͠Δ
ύεϫʔυઃఆ • SendGridͳͲͷϝʔϧαʔϏεͱͷ࿈ܞͰɺ ύεϫʔυ͕ٻΊΒΕΔͷͰɺ ڥม or CredentialͰύεϫʔυΛ RailsଆͰઃఆ͓ͯ͘͠
ϝʔϧαʔϏεଆͷઃఆ ྫɿSendGrid SendGrid͔ΒɺHTTP POSTͯ͠Β͏ʂ https://actionmailbox:password@domain/rails/ action_mailbox/sendgrid/inbound_emails
ศརͳҹ • RspecͳͲͰͷςετॻ͚Δ • ActiveStorageΛ͑ɺS3ͳͲʹอଘͰ͖ΔΒ͠ ͍ • Callbackग़དྷͦ͏ • https://github.com/rails/rails/blob/master/
actionmailbox/lib/action_mailbox/callbacks.rb
ؾʹͳͬͨՕॴ • ϝʔϧαʔϏεଆͷઃఆඞཁʹͳΔ • SendGridͳΒɺInbound ParseͳͲ • Parseͷ༷ཧղ͓͔ͯ͠ͳ͍ͱ͍͚ͳ͍ • SESɺRails
6.1͔ΒͷαϙʔτͱͳΓͦ͏ • https://github.com/rails/rails/commit/ f480cfabcd9000b5817b610e21466299025b12d2 • ެࣜඇެࣜͷυΩϡϝϯτ͕ඇৗʹগͳ͍… • ϝʔϧେྔʹདྷͨΒɺαʔόͲ͏ͳΔͷ͔ͳ…
·ͱΊ
·ͱΊ • Rails AppͰ࿈ܞ͕ඞཁͳ߹ɺॏๅͦ͠ ͏ʂ • ֤ཧऀʹϝʔϧΛసૹͨ͠Γ • ࿈ܞ͕ཁΒͳ͍߹ɺAction Mailbox୯ମ
ͰαʔόཱͯΕྑ͍ؾ…
ऴΘΓ
ࢀߟ • Action Mailbox gem • https://github.com/rails/actionmailbox/tree/master • Rails Guides
• https://edgeguides.rubyonrails.org/ action_mailbox_basics.html • bagelee • https://bagelee.com/programming/ruby-on-rails/rails6- action-mailbox/