smtp_with_gmail

gem install smtp_with_gmail

SMTP

def send_message
  require "time"
  msgstr = <<END_OF_MESSAGE
  From: Your Name <[email protected]>
  To: Destination Address <[email protected]>
  Subject: test message
  Date: #{Time.now.rfc2822}

  test message body.
  END_OF_MESSAGE

  Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)
  Net::SMTP.start("smtp.gmail.com", "587", "your.domain", "username", "password", :plain) do |smtp|
    smtp.send_message msgstr, "[email protected]", "[email protected]"
  end
end

POP

def receive_messages
  Net::POP.enable_ssl(OpenSSL::SSL::VERIFY_NONE)
  Net::POP.start("pop.gmail.com", "995", "username", "password") do |pop|
    p pop.mails[0].pop
  end
end

Contributing to smtp_with_gmail

  • Check out the latest master to make sure the feature hasn’t been implemented or the bug hasn’t been fixed yet.

  • Check out the issue tracker to make sure someone already hasn’t requested it and/or contributed it.

  • Fork the project.

  • Start a feature/bugfix branch.

  • Commit and push until you are happy with your contribution.

  • Make sure to add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright © 2012 Eric Raio. See LICENSE.txt for further details.