Eventful Email in Ruby

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Eventful Email in Ruby - Presentation Transcript

    1. Eventful Email In Ruby - Lightning Talk
    2. Email Processing I’ve Seen • Sometimes done with a catch all alias on the mail server • Store emails as files on disk • Implement a file scanner to read and process messages
    3. Catch All Aliases?
    4. Really?
    5. • Catch All aliases encourage spam to your server • Waste resources processing mail that should be bounced
    6. What Else To Do?
    7. Process Email as it Arrives
    8. Postfix
    9. Event Machine SMTP
    10. WTF • Postfix on port 25 relaying to EM-SMTP • Postfix receives and buffers the email • Forwards it onto EM-SMTP when available
    11. Setup Postfix • Setup Basics • http://articles.slicehost.com/email
    12. /etc/postfix/main.cf myhostname = mydomain.com myorigin = /etc/mailname relayhost = mynetworks = 127.0.0.0/8 relay_domains = mydomain.com transport_maps = hash:/etc/postfix/transport
    13. /etc/mailname mydomain.com
    14. /etc/postfix/transport mydomain.com smtp:[127.0.0.1]:2525
    15. Write Your EM Server class MySmtpServer < EM::Protocols::SmtpServer def initialize(*args) super @parms[:chunksize] = 1024 end
    16. Specify Who Can Receive Return True for OK def receive_recipient(recipient) !!User.first(:email => recipient) end
    17. Tell It What to Do def receive_data_chunk(data) # Do stuff with data # collect it in an ivar # collect in a file true end
    18. Once The Message Is Complete def receive_message # Do Stuff if you’ve collected in an ivar # Or sent to a file # Clear ivar true # false rejects message end
    19. Fire It Up EM.run { EM.start_server \"0.0.0.0\", 2525, MySmtpServer }
    20. More Information http://github.com/eventmachine/eventmachine Huge Thanks to Andy from Octopus Computing http://octopus.com.au/
    SlideShare Zeitgeist 2009

    + hassoxhassox Nominate

    custom

    386 views, 0 favs, 1 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 386
      • 382 on SlideShare
      • 4 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 1
    Most viewed embeds
    • 4 views on http://faces.rubyoceania.org

    more

    All embeds
    • 4 views on http://faces.rubyoceania.org

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories