• Home »
  • Insights »
  • Redmine: The following error occured while sending email notification: 530 5.7.0 Must issue a STARTTLS command first.

Redmine: The following error occured while sending email notification: 530 5.7.0 Must issue a STARTTLS command first.

Recently while working on a CentOS Linux server I downgraded Ruby version 1.8.7 p302 to Ruby version 1.8.6 p399 because of a project that was built for Ruby 1.8.6. The server is a development CentOS Linux server with numerous other projects already operational on it and so downgrading Ruby caused a couple issues one of which was with Redmine project management software. The issue was with sending email notifications for things such as file uploads, added issues, issue updates, etc. Below I describe the error in more detail, the reason for the error, and how to resolve the error sending email notifications.

Redmine Email Notification Sent Through Gmail Error:

Processing FilesController#new (for 192.168.33.111 at 2010-12-10 19:12:36) [POST]
  Parameters: {"commit"=>"Add", "action"=>"new", "authenticity_token"=>"PuUCYzvUiAoRqMxM/QUiIEMAUFCqHbMJ5MvlsqsLkBU=", "id"=>"project1", "controller"=>"files", "version_id"=>"", "attachments"=>{"1"=>{"description"=>"test", "file"=>#<File:/tmp/RackMultipart.30276.1>
}}}
Sending email notification to: alex@example.com
The following error occured while sending email notification: "530 5.7.0 Must issue a STARTTLS command first. x4sm34445550icr.10
". Check your configuration in config/email.yml.
Redirected to https://redmine.example.com/projects/project1/files
Completed in 178ms (DB: 43) | 302 Found [https://redmine.example.com/projects/project1/files/new]

As you can see above the production.log file provides details about the error stating that a STARTTLS command must be issued before the notifications can be sent. On this server we send all Redmine notifications through Gmail. At first I was confused because this had previously been working fine but then I remembered I had to change some things related to Redmine email notification when I had upgraded to Ruby 1.8.7.

Redmine Email Notifications Via Gmail Using Ruby 1.8.6 & Using Ruby 1.8.7 Explained:

The issue is that Ruby 1.8.7 has enable_starttls_auto built in but Ruby 1.8.6 does not. After refreshing my memory I remembered that when using Redmine with Ruby 1.8.6 you are required to install a plugin called action_mailer_optional_tls to get email notifications through Gmail to function properly. Once I had upgraded to Ruby 1.8.7 I removed the action_mailer_optional_tls because it was no longer needed because of the addition of enable_starttls_auto. Since I downgraded Ruby to version 1.8.6 I had to also reinstall action_mailer_optional_tls and modify the email.yml file to get email notifications through Gmail to function properly again.

Redmine Email Notifications Through Gmail With Ruby 1.8.6:

First you need to install the action_mailer_optional_tls Redmine plugin which can be done using the below command from the Redmine Ruby project’s root directory.

Install Redmine action_mailer_optional_tls Plugin:

ruby script/plugin install git://github.com/collectiveidea/action_mailer_optional_tls.git

The above command will install action_mailer_optional_tls into “redmine-project-root/vendor/plugins”. Once this is installed modify your email.yml to be similar to the below example email.yml but obviously changing the specifics to your own. The email.yml file is located in the config directory underneath the Redmine projects root directory.

Example email.yml For Ruby Version 1.8.6:

# Outgoing email settings
production:
  delivery_method: :smtp
  smtp_settings:
    tls: true
    address: "smtp.gmail.com"
    port: '587'
    domain: "DOMAIN"
    authentication: :plain
    user_name: "GMAIL USERNAME (ex: user@domain.com)"
    password: "CHANGE PASSWORD"

production:
  delivery_method: :smtp
  smtp_settings:
    tls: true
    address: "smtp.gmail.com"
    port: '587'
    domain: "DOMAIN"
    authentication: :plain
    user_name: "GMAIL USERNAME (ex: user@domain.com)"
    password: "CHANGE PASSWORD"

If you do not have a domain pointed to Google for email then just use smtp.gmail.com for the domain settings.

Redmine Email Notifications Through Gmail With Ruby 1.8.7:

With Ruby 1.8.7 the configuration is a little bit easier since you do not have to install a plugin to have it function properly. If you have Ruby 1.8.7 or any version of Ruby greater than 1.8.7 then the example email.yml file should work properly for you. If you previously had the action_mailer_optional_tls plugin installed it can now be removed.

Example email.yml For Ruby Version 1.8.6:

# Outgoing email settings

production:
  delivery_method: :smtp
  smtp_settings:
    tls: true
    enable_starttls_auto: true
    address: smtp.gmail.com
    port: 587
    domain: "GMAIL DOMAIN"
    authentication: :login
    user_name: "GMAIL USERNAME (ex: redmine@example.com)"
    password: "GMAIL PASSWORD"

production:
  delivery_method: :smtp
  smtp_settings:
    tls: true
    enable_starttls_auto: true
    address: smtp.gmail.com
    port: 587
    domain: "GMAIL DOMAIN"
    authentication: :login
    user_name: "GMAIL USERNAME (ex: redmine@example.com)"
    password: "GMAIL PASSWORD"

Once the email.yml file has been modified on either version of Ruby simply restart your web server and then test. You can tail the production.log file to verify the notifications are being sent properly.


List Price: $39.99 USD
New From: $23.40 USD In Stock
Used from: $17.99 USD In Stock

The Ruby Programming Language (Paperback)

By (author): David Flanagan, Yukihiro Matsumoto


List Price: $39.99 USD
New From: $21.49 USD In Stock
Used from: $10.82 USD In Stock

Share