Slide 1

Slide 1 text

Email on Rails

Slide 2

Slide 2 text

2012

Slide 3

Slide 3 text

2012

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

Generating a Mailer in Rails $  rails  generate  mailer  UserMailer   create    app/mailers/user_mailer.rb   invoke    erb   create        app/views/user_mailer/  

Slide 6

Slide 6 text

Sending email - ActionMailer::Base class class UserMailer < ActionMailer::Base default from: '[email protected]' def welcome_email(user) @user = user @url = 'http://example.com/login' mail(to: @user.email, subject: 'Welcome to My Awesome Site') end end A cross between a Model and a Controller

Slide 7

Slide 7 text

Sending Email in Plain Text Welcome to example.com, <%= @user.name %> =============================================== You have successfully signed up to example.com, your username is: <%= @user.login %>. To login to the site, just follow this link: <%= @url %>. Thanks for joining and have a great day! app/views/user_mailer/welcome_email.text.erb A view that is rendered over SMTP

Slide 8

Slide 8 text

Sending Email in HTML

Welcome to example.com, <%= @user.name %>

You have successfully signed up to example.com, your username is: <%= @user.login %>.

To login to the site, just follow this link: <%= @url %>.

Thanks for joining and have a great day!

app/views/user_mailer/welcome_email.html.erb

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

Receiving email in Rails “Receiving and parsing emails with Action Mailer can be a rather complex endeavor. Before your email reaches your Rails app, you would have had to configure your system to somehow forward emails to your app, which needs to be listening for that.” - guides.rubyonrails.org/action_mailer_basics.html

Slide 11

Slide 11 text

Receiving email in Rails “Receiving and parsing emails with Action Mailer can be a rather complex endeavor. Before your email reaches your Rails app, you would have had to configure your system to somehow forward emails to your app, which needs to be listening for that.” - guides.rubyonrails.org/action_mailer_basics.html

Slide 12

Slide 12 text

Receiving Email in Rails IRL - In Real Life To The CLOUD

Slide 13

Slide 13 text

Example app for receiving email with ! https://github.com/CodeFellowsOrg/postmark-mitt-example

Slide 14

Slide 14 text

Example app for receiving email with ! https://github.com/CodeFellowsOrg/postmark-mitt-example

Slide 15

Slide 15 text

• Endpoints for web APIs to POST to • Enable: • Service Integration • Compostability, Encapsulation, Polymorphism, all good things! • http://localhost:3000/incoming_email • a Controller with an action to handle POST

Slide 16

Slide 16 text

http://www.ultrahook.com

Slide 17

Slide 17 text

end