![]() | Using Gmail to send mail |
|
13 Jun 2008, 17:12
Larry Cummings (1 post) |
I’ve been having quite the time getting this recipe to do anything. A little “here’s a good way to debug this” help would have helped this section. Couple things that worked for me.: 1) the svn repository provided does not respond at all. A comment in Daniel Fischer’s original post about this provides a working repository here: http://svn.nanorails.com/plugins/action_mailer_… (and incidentally nanorails will work with script/plugin install). 2) once installed, I can’t get it to work on the live server. Mysteriously it connects like a champ when I run it locally (it makes no difference if I run it in Production or Development mode, btw). Here’s the output I get when I run it from the console on the live server:
Any ideas? |
|
07 Jul 2008, 21:14
Jason Schmidt (4 posts) |
Here is the code I have used, and works in both dev and production…
require “smtp_tls” ActionMailer::Base.smtp_settings = {
:address => “smtp.gmail.com”,
:port => 587,
:domain => “YOURDOMAIN.com”,
:authentication => :plain,
:user_name => “EMAIL@YOURDOMAIN.com”,
:password => “PASSWORD” - vendor/plugins/action_mailer_tls/init.rb require_dependency ‘smtp_tls’ - vendor/plugins/action_mailer_tls/lib/smtp_tls.rb require “openssl” Net::SMTP.class_eval do private def do_start(helodomain, user, secret, authtype) raise IOError, ‘SMTP session already started’ if @started check_auth_args user, secret, authtype if user or secret
|
|
07 Jul 2008, 21:14
Jason Schmidt (4 posts) |
Uck. Code formatting got all wacky |
|
09 Jul 2008, 22:29
Daniel Fischer (1 post) |
If it works locally, nothing should be preventing it from working on your server besides server related misconfiguration. Double check your iptables. One other thing I’d double check, and this is from experience, make sure your e-mail account on google wasn’t flagged for spam. That happened on production for me because I was testing it by sending mail to something@example.com and because I was going through gmail for that, they labeled that account as “spam”. So, try create a new account and use those settings. It should work. |
|
22 Jul 2008, 17:44
Jay (3 posts) |
Your issue may be related to ruby versions. A 1.8.7-compatible version of this plugin has not been released yet (check date of this post). If you want to use ruby 1.8.7 right now, you can hack the plugin yourself: the smtp_tls.rb file needs to be changed on line 8. 8 #change below for 1.8.7 9 #check_auth_args user, secret, authtype if user or secret 10 check_auth_args user, secret if user or secret Alternatively, you can use ruby 1.8.6 versions until a compatible plugin comes out for 1.8.7. |
|
08 Feb 2009, 22:14
Saul Mora (1 post) |
In case anyone needs it, OpenRain has been migrating their library of opensource code to github lately. The action_mailer_tls code is now here: |
|
11 Feb 2009, 17:54
Marc Chung (3 posts) |
Hi everyone, I’m the original author of this plugin. I apologize for the SVN issue. I was only recently made aware that the URL for the repository was directly referenced in Advanced Rails Recipes. Like Saul mentioned, we’ve moved a lot of our code over to GitHub. The code’s new home is now referenced here: openrain-action_mailer_tls href=”http://github.com/openrain/action_mailer_tls/tree/master”>http://github.com/openrain/action_mailer_tls/tr… Some additional notes:
To enable support for TLS with Rails 2.2.1, you need an initializer (for example, config/initializers/smtp_gmail.rb) with the following settings:
Currently the gem does not have support for Ruby 1.8.7. |
|
11 Feb 2009, 17:57
Marc Chung (3 posts) |
Obviously, the ”:user_name” field in the snippet of YAML doesn’t need to have the anchor mailto link. It was added by the forum |
|
11 Feb 2009, 19:23
Marc Chung (3 posts) |
Larry: I’m sure you’ve already figured this out by now.. but for everyone else: The problem you’re specifically seeing is caused by an incorrect username and password combination. Make sure it’s the full email address (“foo@example.com” or “billg@gmail.com“). Also, the YAML file requires no quotes. See my previous YAML example. (Assuming that example.com is run by Google Apps) |
|
30 Aug 2009, 18:21
Mike Diamond (1 post) |
Answered my question, thanks. |
|
25 Nov 2009, 12:25
Steven Noble (20 posts) |
So if it’s now a gem not a plugin, we don’t need ‘require “smtp_tls”’ at the head of config/initializers/smtp_gmail.rb? |
| You must be logged in to comment |

