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
horikawa
May 15, 2019
Programming
400
0
Share
Rails 6.0 Action Mailboxについて
otemachi.rb#17で発表した資料
horikawa
May 15, 2019
More Decks by horikawa
See All by horikawa
Caching associations in rails
casix
1
330
Create Action Mailbox Sample Application
casix
1
440
Rails 4.2→5.2アップデート
casix
0
460
Other Decks in Programming
See All in Programming
The Arts and Crafts of Work in the AI Era — Toward Mastery in Software Development
kuranuki
0
350
CSC307 Lecture 17
javiergs
PRO
0
240
誰も頼んでない機能を出荷した話
zekutax
0
130
iOS26時代の新規アプリ開発
yuukiw00w
0
200
20260514 - build with ai 2026 - build LINE Bot with Gemini CLI
line_developers_tw
PRO
0
470
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
120
Oxlintはいかにしてtsgolintのlint ruleを呼び出しているのか
syumai
1
480
tsserverとは何だったのか、これからどうなるのか
nowaki28
1
380
実践ハーネスエンジニアリング:ステアリングループを実例から読み解く / Practical Harness Engineering: Understanding Steering Loops Through Real-World Examples
nrslib
6
6.3k
Why Laravel apps break—Mastering the fundamentals to keep them maintainable
kentaroutakeda
1
200
Talking to terminals (and how they talk back) (KotlinConf 2026)
jakewharton
PRO
1
120
Composerを使ったサプライチェーン攻撃の様子を眺めてみる #phpstudy
o0h
PRO
2
140
Featured
See All Featured
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
240
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Paper Plane
katiecoart
PRO
1
50k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
120
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
270
Un-Boring Meetings
codingconduct
0
300
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.9k
The untapped power of vector embeddings
frankvandijk
2
1.7k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
190
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
300
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/