Emailing With Latest Redmine, Rails 2.1, and Gmail

Added by Jim Mulholland over 11 years ago

I pulled the latest Redmine code from the edavis10/redmine github repo yesterday to checkout the latest codebase.

I got the site to run without problems.

However, I have had no luck getting the email.yml file to work to email from our GMail smtp server. Has anybody else got this to work?

Mail.yml:

# Outgoing email settings

production:    
  delivery_method: :smtp
  smtp_settings:
    address: smtp.gmail.com
    port: 587
    domain: "yourdomain.com" 
    authentication: :login
    user_name: "user@email.com" 
    password: "password" 

development:
  delivery_method: :smtp
  smtp_settings:
    address: "smtp.gmail.com" 
    port: 587
    domain: "yourdomain.com" 
    authentication: :login
    user_name: "user@email.com" 
    password: "password" 

Also, to email from Gmail in the past, I had to add a "smtp_tls.rb" file in the "lib" directory and add a "require 'smtp_tls'" to the environment.rb. I'm not positive this is still necessary with Rails 2.1, but I added it anyway.

To test, I browse to "Administration -> Settings -> Email Notifications Tab" and click the "Send A Test Email" link. After I click, I get a green notice that an email has been sent and there are no errors in my error log, but I never get an email.

Has anybody else had luck sending emails through Gmail's smtp server via Redmine's mail.yml architecture?

Replies (13)

RE: Emailing With Latest Redmine, Rails 2.1, and Gmail - Added by Thomas Lecavelier over 11 years ago

Just to be sure: you give your admin user (the one when connected with, you request the mail test) a valid email adress and you checked your junk folder?

RE: Emailing With Latest Redmine, Rails 2.1, and Gmail - Added by Jim Mulholland over 11 years ago

Thanks for the quick reply, Thomas.

I remember going back and forth on another email issue with either you or JP last year and the issue was that I had a filter that bypassed my inbox and put all incoming tickets into a "Ticket" folder. ;-)

Unfortunately, that does not appear to be the case this time. No filters, my spam folders are clean, and my email address is good.

Let me grab my old email setup code in environment.rb to see if that still works.

RE: Emailing With Latest Redmine, Rails 2.1, and Gmail - Added by Jim Mulholland over 11 years ago

So I got email to work but I had to uncheck the "I don't want to be notified of changes that I make myself" checkbox on my Account page and update a ticket that was assigned to me. Even with that, the "Send a test email" link still did not work.

I also installed this plugin to help with the gmail smtp emails:

http://douglasfshearer.com/blog/gmail-smtp-with-ruby-on-rails-and-actionmailer

and modified my email.yml to look like this:

# Outgoing email settings

production:    
  delivery_method: :smtp
  smtp_settings:
    address: "smtp.gmail.com" 
    port: "587" 
    domain: "yourdomain.com" 
    authentication: :login    
    user_name: "user@email.com" 
    password: "password" 

development:
  delivery_method: :smtp
  smtp_settings:
    address: "smtp.gmail.com" 
    port: "587" 
    domain: "yourdomain.com" 
    authentication: :login
    user_name: "user@email.com" 
    password: "password" 

RE: Emailing With Latest Redmine, Rails 2.1, and Gmail - Added by Thomas Lecavelier over 11 years ago

Please precise the error reported in your log, now.

RE: Emailing With Latest Redmine, Rails 2.1, and Gmail - Added by Jim Mulholland over 11 years ago

Hi Thomas,

There were no errors in my log.

For some reason, when I click the "Send a test email" link, it just does not send. The log shows the email to be sent without any error messages.

RE: Emailing With Latest Redmine, Rails 2.1, and Gmail - Added by Thomas Lecavelier over 11 years ago

So that means ActionMailer has discussed correctly with the smtp server, the problem is there: could you have an access to some logs about your usage of smtp.google.com?

RE: Emailing With Latest Redmine, Rails 2.1, and Gmail - Added by Calvin Cheng over 11 years ago

Hi Jim,

I encountered a similar problem to what you are describing.

This was reported as Issue #1598. When I fiddled with the various settings and email configuration in email.yml file, I did arrive at one point where I actually could "send an email" but no email was actually sent.

Not sure if this is your problem or not but from issue #1598, you can see that Burt Culver's proposed solution worked for me. I had to modify line 33 in vendor/plugins/action_mailer_optional_tls/lib/smtp_tls.rb

Regards,
Calvin

RE: Emailing With Latest Redmine, Rails 2.1, and Gmail - Added by Ken Chau over 11 years ago

You're almost right with Gmail as your smtp sender. Here's what I did:

Step 1: Set up the plugin here for actionmail to be able to send mail via tls:

./script/plugin install http://svn.douglasfshearer.com/rails/plugins/action_mailer_optional_tls

Step 2: Modify email.yml

production:    
  delivery_method: :smtp
  smtp_settings:
    address: "smtp.gmail.com" 
    port: "25" 
    domain: "yourdomain.com" 
    authentication: :login    
    user_name: "user@email.com" 
    password: "password" 
    tls: true

RE: Emailing With Latest Redmine, Rails 2.1, and Gmail - Added by eligio colutta about 11 years ago

i installed action_mailer_optional_tls from svn as suggested, but after installation, redmine doesn't work :

here is the console log :

# ruby script/server -e production -p 3301 -b 78.159.98.60 
=> Booting WEBrick...
/var/rails/redmine-0.7.3/vendor/rails/activesupport/lib/active_support/dependencies.rb:263:in `load_missing_constant': uninitialized constant ActiveSupport::Callbacks (NameError)
    from /var/rails/redmine-0.7.3/vendor/rails/activesupport/lib/active_support/dependencies.rb:453:in `const_missing'
    from /var/lib/gems/1.8/gems/actionpack-2.1.1/lib/action_controller/dispatcher.rb:96
    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
    from /usr/lib/ruby/1.8/rubygems/custom_require.rb:27:in `require'
    from /var/rails/redmine-0.7.3/vendor/rails/activesupport/lib/active_support/dependencies.rb:496:in `require'
    from /var/rails/redmine-0.7.3/vendor/rails/activesupport/lib/active_support/dependencies.rb:342:in `new_constants_in'
    from /var/rails/redmine-0.7.3/vendor/rails/activesupport/lib/active_support/dependencies.rb:496:in `require'
    from /var/rails/redmine-0.7.3/vendor/rails/railties/lib/dispatcher.rb:23
     ... 16 levels...
    from /var/rails/redmine-0.7.3/vendor/rails/activesupport/lib/active_support/dependencies.rb:496:in `require'
    from /var/rails/redmine-0.7.3/vendor/rails/railties/lib/commands/server.rb:39
    from script/server:3:in `require'
    from script/server:3

if i delete /var/rails/redmine-0.7.3/vendor/plugins/action_mailer_optional_tls folder, redmine start with no problem.

i have :
ruby 1.8.5
rails 2.1.1 (gem install rails : Successfully installed rails-2.1.1)
redmine 0.7.3

RE: Emailing With Latest Redmine, Rails 2.1, and Gmail - Added by eligio colutta about 11 years ago

more infos :

About your application's environment
Ruby version              1.8.5 (i486-linux)
RubyGems version          0.9.0
Rails version             2.0.2
Active Record version     2.0.2
Action Pack version       2.1.1
Active Resource version   2.0.2
Action Mailer version     2.1.1
Active Support version    2.1.1
Edge Rails revision       rel_2-0-2
Application root          /var/rails/redmine-0.7.3
Environment               development
Database adapter          mysql

RE: Emailing With Latest Redmine, Rails 2.1, and Gmail - Added by aeron chang about 11 years ago

Hi,

I am having the exact same problem when sending a test email. I have read through other topics covering this issue. It seems this is still an unsolved problem in 0.7.3. I installed 0.7.3 Redmine using BitNami's stack (http://bitnami.org/stack/redmine). Everything works great out of box on my Mac machine.

Here is what I have done so far:
  1. Installed the plugin for actionmail of option tls
  2. Added "email.yml" into ./config folder, I have searched everywhere, I don't see the file email.yml
  3. Modify the line 33 in vendor/plugins/action_mailer_optional_tls/lib/smtp_tls.rb
    def do_tls_start(helodomain, user, secret, authtype)
    raise IOError, 'SMTP session already started' if @started
    check_auth_args user, secret if user or secret

I removed 'authtype' from original line 33
check_auth_args user, secret, authtype if user or secret
to
check_auth_args user, secret if user or secret

The error still exist. Please help.

RE: Emailing With Latest Redmine, Rails 2.1, and Gmail - Added by Matthew Kosterman about 11 years ago

We were having similar issues after upgrading to 0.7.devel.

Here's what we did to fix:

In the environment.rb file, there was this problem:

config.action_mailer.perform_deliveries = false

Which isn't going to help matters. ;-)

Also, we are using a Mac OS X 10.4.11 Server with Postfix. When the user_name value in email.yml contains "@domain.com" it doesn't work. Just enter the user's name.

RE: Emailing With Latest Redmine, Rails 2.1, and Gmail - Added by Laran Evans about 11 years ago

The instructions for using Gmail see WAY different than what's in the online documentation. The documentation online doesn't mention anything about email.yml. Are there any plans to update the documentation online?

(1-13/13)