Project

General

Profile

gmail and email.yml

Added by Martin Hall almost 16 years ago

I am running 0.8 build 2170

I have looked and I have not found a working email.yml (for me). It says that it works but nothing gets sent.

Anything obvious with this setup?

  1. Outgoing email settings

production:
delivery_method: :smtp
smtp_settings:
address: smtp.gmail.com
port: 587
domain: gmail.com
authentication: :plain
user_name: xxx
password: xxx
tls: true


Replies (38)

RE: gmail and email.yml - Added by Dan Cameron almost 16 years ago

I think you may need to do a little bit more then just use those settings. This may help

I was going to use gmail but opted for my local server to handle outgoing and setup gmail imap for incoming.

RE: gmail and email.yml - Added by Dan Cameron almost 16 years ago

I think you may need to do a little bit more then just use those settings. This may help

I was going to use gmail but opted for my local server to handle outgoing and setup gmail imap for incoming.

RE: gmail and email.yml - Added by Martin Hall almost 16 years ago

I looked at the information on the link that Dan Cameron gave above (on the ExpanDrive site).

I keep getting:

x An error occurred while sending mail (wrong number of arguments (7 for 6))

For the life of me — I cannot figure what it might be….
This is what I have in the email.yml:

#Outgoing email settings

production: 
    delivery_method: :smtp 
    smtp_settings:
       address: smtp.gmail.com 
       port: 587 
       domain: gmail.com 
       authentication: :login 
       user_name: mlwhall 
       password: password

and I have the loaded the smtp_tls in lib and added require ’smtp_tls’ to the config/environment/production.rb

Any thoughts that might help?

RE: gmail and email.yml - Added by Dan Cameron almost 16 years ago

My guess:

You still need to use the-tls: true

From my experience with gmail you'll need the "@gmail" in your username.

RE: gmail and email.yml - Added by Martin Hall almost 16 years ago

Dan, et al.:

I appreciate the help -- still not quite working. I guess this is what I get for going with 0.8 (was working with 0.7).

I added

@gmail.com to the address

and

tls: true

at the bottom. Still getting the 7 of 6 error (kind of makes you think of 7 of 9 from Star Trek) mentioned above. Hmmm.

I must be doing something stupid...

RE: gmail and email.yml - Added by Martin Hall almost 16 years ago

Hi,

I cannot seem to get this working with gmail or the more straightforward manner - I would be willing to pay someone a little to help me get this up and running properly. Trying to do this has started taken energy away from the project that it is supposed to track --

Cheers!

RE: gmail and email.yml - Added by Dan Cameron almost 16 years ago

Hey Martin,

It took all morning but I got it working on my server.

First I used this script but there's some necessary changes that need to be made.

Instead of downloading his smtp_tls.rb just use this

Then make sure you update your email.yml, here is mine:

production:
  delivery_method: :smtp
  smtp_settings:
    address: smtp.gmail.com
    port: 587
    domain: gmail.com
    authentication: :login
    user_name: XXXX@sproutventure.com
    password: XXXXXXXX

Now I'm using google apps but you should be able to adjust the username and password and it will work.

Note: Notice there's no tls: true and you will need to add:

To your production.rb like the instruction state. Mine looks like this:

...

# No email in production log
config.action_mailer.logger = nil

# TLS for Gmail SMTP
require 'smtp_tls'

Remember, I have an amazon wish list

RE: gmail and email.yml - Added by Dan Cameron almost 16 years ago

Remember, I have an amazon wish list

:-)

RE: gmail and email.yml - Added by Martin Hall almost 16 years ago

At the risk of sounding stupid, where do I put the smtp_tls.rb?

RE: gmail and email.yml - Added by Dan Cameron almost 16 years ago

At the risk of sounding stupid, where do I put the smtp_tls.rb?

In the lib folder.

RE: gmail and email.yml - Added by Martin Hall almost 16 years ago

Ok -- I have made all the changes -- I am still getting the same error (7 0f 6 error mentioned above)-- which is making me think that (at some point) I changed a wrong file or something. The files that I have dealt with and I believe have either returned to normal or changed as suggested:

lib/smtp_tls.rb
config/email.yml
config/environment.rb (believe this is set to original state)
config/environments/production.rb

The plugin from: http://blog.expandrive.com/2008/12/04/redminerails-email-through-gmail-smtp/comment-page-1/

Barring this, how can I recreate all this w/o losing the data (I guess MySQL). Delete everything and reload?

RE: gmail and email.yml - Added by Martin Hall almost 16 years ago

ok -- I deleted my copy of redmine code -- reloaded it; and made the changes above....

I now get:

An error occurred while sending mail (wrong number of arguments (2 for 3))

At least it is now not 7 of 6 but 2 of 3 does not cut it either. I am getting to wits end!

RE: gmail and email.yml - Added by Dan Cameron almost 16 years ago

Trust me, I felt the same way you did this morning. 5 hours of errors and logs didn't help.

You're using my version of smtp_tls.rb right?

It sounds like progress since just before it started working I had the same error.

This sounds simple but make sure to reload your webserver and restart redmine.

RE: gmail and email.yml - Added by Jean-Yves . almost 16 years ago

I hope this will help you with this problem.
I installed redmine 0.8.0 yesterday and found out that i can't use gmail for smtp because of the tls thing.
After a bit of searching i've found a link to a plugin in an old forum post (http://www.redmine.org/boards/2/topics/show/1784) and some other links.

the link now: http://douglasfshearer.com/blog/gmail-smtp-with-ruby-on-rails-and-actionmailer
i've installed the given plugin like he said in his blog post
./script/plugin install http://svn.douglasfshearer.com/rails/plugins/action_mailer_optional_tls

then edited my email.yml to look like this:
production:
delivery_method: :smtp
smtp_settings:
tls: true
address: smtp.gmail.com
port: 587
domain: YOURDOMAIN
authentication: :login
user_name: GOOGLEUSERNAME
password: GOOGLEPASSWORD

and then restarted the application. And the test email was send just fine :)

For info i run redmine with mod passenger (www.modrails.com) and ruby enterprise (http://www.rubyenterpriseedition.com/) on Ubuntu 8.04 Server LTS

RE: gmail and email.yml - Added by Jean-Yves . almost 16 years ago

oups... i'm not familiar with the formating sorry
this should look more friendly for the email.yml part

production:
    delivery_method: :smtp
    smtp_settings:
        tls: true
        address: smtp.gmail.com
        port: 587
        domain: YOURDOMAIN
        authentication: :login
        user_name: GOOGLEUSERNAME
        password: GOOGLEPASSWORD

RE: gmail and email.yml - Added by Martin Hall almost 16 years ago

Dan,

I stopped and started Apache and then restarted redmine: (FYI: /usr/local/bin/ruby /usr/local/bin/mongrel_rails start -p 4005 -d -e production -c /home/redmine/redmine )

I have your new smtp_tls.rb that I got from your git repo.

(Jean: I tried most if not all of what you did and I am still getting the errors).

RE: gmail and email.yml - Added by Martin Hall almost 16 years ago

This still does not work.

Gosh, I wish this was not so hard. I guess I am not the only one with this issue.

RE: gmail and email.yml - Added by Ryan Macaluso almost 16 years ago

I am at the same place as Martin and totally stuck.

Is this an issue because we are trying to use gmail as our SMTP server?

Is setting up the email notification functionality as simple as changing the email.yml file if you have a SMTP server running locally?

It just seems ridiculously hacky and difficult setting this up with gmail, although that would be preferred.

Thanks,
Ryan

RE: gmail and email.yml - Added by David Bronke almost 16 years ago

I've tried all the steps outlined by both Dan Cameron and by Jean-Yves Gréau, and I can't get it to work either; I'm getting the same error as Martin Hall, currently. (wrong number of arguments (2 for 3))

I've made sure to clean out the plugin that Jean-Yves suggested, to ensure that leftovers from that attempt were'nt causing anything, but i'm still getting the same error. (I was also getting this error before I tried his instructions)

If Redmine would give me some sort of backtrace or something I could try debugging the code, but I can't even tell what file the error is coming from. I've tried increasing the amount of reporting done in production.rb, but it hasn't given me any more information.

Dan, how did you get it to work after getting this error?

RE: gmail and email.yml - Added by Martin Hall almost 16 years ago

Hi all

The issue seems to be fixed now on my end. The hosting provider did:

I've reinstalled the plugin action_mailer_optional_tls and copied the smtp_tls.rb from vendor/plugins/action_mailer_optional_tls/lib/smtp_tls.rb to lib/smtp_tls.rb.

It is not clear to me, but it seems that port 587 that Gmail uses might need to be opened (not sure about this part since I had them open this before the above).

This is this my current email.yml (with obvious stuff hidden).

# Outgoing email settings

production:
    delivery_method: :smtp
smtp_settings:
     address: smtp.gmail.com
     port: 587
     domain: gmail.com
     authentication: :login
     user_name: mylogin@gmail.com 
     password: xxxxxx

I'm able to send test email now. Presumably, this should work for Google Apps -- but I have not tried that yet. ;-)

I guess I better go and look at Dan's Amazon Wish List

I hope this works for others. I know it has been insanely frustrating for me.

RE: gmail and email.yml - Added by Dan Cameron almost 16 years ago

Martin:
Glad to hear it started working.

David:
It's been a while since I worked on this but you need to make sure you don't have conflicting settings (from trying all of the other tutorials out there) and to restart after every modification in your testing.

RE: gmail and email.yml - Added by David Bronke almost 16 years ago

Ok, I got it working, but I had to take a couple of steps to make it work:
  • Install the action_mailer_optional_tls plugin (from Jean-Yves Greau's comment)
  • Copy vendor/plugins/action_mailer_optional_tls/lib/smtp_tls.rb to lib/smtp_tls.rb (from Martin Hall's comment)
  • Edit my config/email.yml as follows:
    production:
      delivery_method: :smtp
      smtp_settings:
        address: smtp.gmail.com
        port: 587
        domain: g33xnexus.com
        authentication: :login
        user_name: redmine@g33xnexus.com
        password: lofOjnujMicyed^
        tls: true
    
  • Install version 2.1.2 of actionmailer, actionpack, and activesupport on my server. (in addition to the same versions of these existing in /opt/redmine-0.8.0/vendor/rails/) If this is not done, the smtp_tls.rb script complains "Could not find RubyGem actionmailer," and if a different version is installed, it says something about a different version of actionmailer already being activated.

RE: gmail and email.yml - Added by Gabriela Davila almost 16 years ago

I've installed the action mailler but on my folder "vendor/plugin" doen't exist the folder "action_mailer_optional_tls"...

please someone help me.

RE: gmail and email.yml - Added by Michael Binder almost 16 years ago

So I have followed everything that David said to do but I still get an error stating:

An error occurred while sending mail (Connection refused - connect(2))

Any ideas how to fix this?

RE: gmail and email.yml - Added by Sergi de Pablos almost 16 years ago

Just followed what David said and everything is working. Just one question: have you enabled IMAP access in the account you're trying to use (login into your gmail account -> Settings -> Forwarding and POP/IMAP -> Enable IMAP)?

(1-25/38)