Using Gmail for notification messages

Added by Simon Thompson almost 9 years ago

An answer, rather than a question. Difficulties using Gmail for notification messages appear all over the forums but there doesn't seem an ideal one to add my solution to it. So here goes....

I'm using a cloud hosted version of Redmine, based on the Turnkey Linux, but manually upgraded to 1.2.1 (Ruby 1.8.7, Rails 2.3.8)

My corporate email firewall didn't like email from an IP address in a 'flexible' range so I decided to use email rather than Postfix/Sendmail. I didn't want Redmine to handle incoming mail.

The answer was in these forums, but rather scattered about. Here's what to do in my situation.

1. Set up a gmail account
2. Set up forwarding to your usual email address in case someone replies to a notification (sigh..)
2. Change your Redmine / admin / settings / email notifications to match
3. Edit your Redmine configuration.yml in the application config directory so you have just one 'production' entry:

production:
email_delivery:
delivery_method: :smtp
smtp_settings:
tls: true
enable_starttls_auto: true
address: "smtp.gmail.com"
port: 587
domain: "smtp.gmail.com"
authentication: :plain
user_name: ""
password: passwordnotinquotes

[it's the missing TLS related lines that do the damage - without 'enable_starttls_auto' you get a '503' warning from Gmail ]

4. Stop & restart Apache to load the configuration. If Redmine starts again, go to 5. If not check your syntax in configuration.yml and try again.
5. Enjoy email notifications. However, you might want to do the following to check..
6. Login to Redmine (as an administrator), go to / admin / settings / email notifications and hit the 'send test email' at bottom right
7. You should get a green 'OK' message at the top go to 8. If not there will be an error message from the Gmail server that you may need to resolve. Sorry, was OK for me so you're on your googling own...
8. This test email will have upset Gmail as it looks suspicious. Log in to Gmail and reset your password. That test email should be in your inbox.
9. Edit configuration.yml (again), update your password and restart Apache.
10. All should be well.

Hope that all helps somebody.

Replies (3)

RE: Using Gmail for notification messages - Added by Andrew Vit almost 9 years ago

Very helpful, thank you!

I recently updated to Redmine 1.2 and was not receiving emails. The error was:

An error occurred while sending mail (530 5.7.0 Must issue a STARTTLS command first. ko15sm47377622pbb.9 )

Even though I copied everything over correctly, I was missing in the `enable_starttls_auto` in the old email.yml file, so even after I added it, it wasn't working. I should have been looking in configuration.yml instead.

Works as advertised.

RE: Using Gmail for notification messages - Added by Nurettin Onur TUĞCU almost 9 years ago

Side-notes for users of redmine 1.2.1:

  1. Default .gitignore had config/configuration.yml which kept me wondering why my email settings weren't getting pushed for a few minutes.
  2. config/configuration.yml.example has empty stubs for production: and development: elements. I erased them to get my settings to work.

My settings for a custom domain was (modified from the above post)

production:
   email_delivery:
     delivery_method: :smtp
     smtp_settings: 
       tls: true
       enable_starttls_auto: true
       address: "smtp.gmail.com" 
       port: 587
       domain: "customdomain.com" 
       authentication: :login
       user_name: "mailaccount@customdomain.com" 
       password: passwordnotinquotes

RE: Using Gmail for notification messages - Added by Jorge Bedoya Rusenko over 7 years ago

I have a problem when I set the file config.ym for notifications

Redmine 2.1.6
Ruby 3.2.11

production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings: 
      tls: true
      enable_starttls_auto: true
      address: "smtp.gmail.com" 
      port: 587
      domain: "smtp.gmail.com" 
      authentication: :plain
      user_name: "my_email@gmail.com" 
      password: my_password

when I send a test email I get this error

An error occurred while sending mail (execution expired)

I could help solve this problem?

I connect to the internet right through a proxy

(1-3/3)