mail configuration not working

Added by Tilman Wittenhorst about 9 years ago

Hello,

I set up Redmine on Debian Lenny, application home is /usr/share/redmine. In config/, there was no email.yml.example file, so I pasted an example from the web page to email.yml and customized it.

Still, the application says "smtp server not configured". What's wrong? the file is in /usr/share/redmine/config, but it looks like it is not found there.

We use

production:
delivery_method: :sendmail

sendmail is working on this system.

thanks

Replies (11)

RE: mail configuration not working - Added by Felix Schäfer about 9 years ago

You need to make sure there a 2 whitespaces (I think it was 2) in front of the options of the environment, i.e. something like:

production:
  delivery_method: :sendmail

Also make sure the file is accessible (readable) by the user running redmine.

RE: mail configuration not working - Added by Romain Blanchet about 9 years ago

Hello,

I have exactly the same issue with Ubuntu 10.04: there is no email.yml or example file.
I created one, using the example in the wiki.

I installed redmine using "sudo aptitude install redmine redmine-mysql" and I also have "smtp server not configured" in redmine.

When I manually modify "config.action_mailer.perform_deliveries" in /usr/share/redmine/config/environment.rb and set it at "true", it's possible to modify the mailing settings in redmine.

I use the sendmail method but I don't get any mail.
When I try the command line "echo testing | mail -s test ", I get a mail.

I've also chmod 777 the email.yml file...

Thanks

RE: mail configuration not working - Added by Felix Schäfer about 9 years ago

Ok, so this seems to be some issue with the debian/ubuntu package, right?

I just had a look at the ActionMailer API, and it seems AM looks for the sendmail excutable under /usr/sbin/sendmail, is it there? I haven't used sendmail either, so I can't tell you how it's called, but it seems the default options AM uses is -i -t, does it make sense to you?

RE: mail configuration not working - Added by Tilman Wittenhorst about 9 years ago

There are two whitespaces in the config file, and sendmail is in /usr/sbin as usual. -i -t is common usage - in my case it is nullmailer providing a sendmail binary.

Can I get a more detailed error message from Redmine to determine what is wrong? Just saying 'SMTP is not configured' is bit short.

RE: mail configuration not working - Added by Felix Schäfer about 9 years ago

Mmh, do you have a config/initializers/40-email.rb in your Redmine directory?

RE: mail configuration not working - Added by Tilman Wittenhorst about 9 years ago

yes:

  1. Loads action_mailer settings from email.yml
  2. and turns deliveries on if configuration file is found

filename = ENV['RAILS_ETC'] ? File.join(ENV['RAILS_ETC'], 'email.yml') : File.join(File.dirname(FILE), '..', 'email.yml')
if File.file?(filename)
mailconfig = YAML::load_file(filename)

if mailconfig.is_a?(Hash) && mailconfig.has_key?(Rails.env)
  # Enable deliveries
ActionMailer::Base.perform_deliveries = true
mailconfig[Rails.env].each do |k, v|
v.symbolize_keys! if v.respond_to?(:symbolize_keys!)
ActionMailer::Base.send("#{k}=", v)
end
end
end

RE: mail configuration not working - Added by Felix Schäfer about 9 years ago

Ok, so if you have a file config/email.yml with the configuration from up there and run in production mode, it should work without the need to change anything in any configration or environment.rb or whatnot. Make sure the user running redmine can read the email.yml.

RE: mail configuration not working - Added by Felix Schäfer about 9 years ago

Mmh, just had a case with a guy having redmine on ubuntu, it seems he needed to put his email.conf in /etc/default/redmine (or whatever). Maybe that helps.

RE: mail configuration not working - Added by Tilman Wittenhorst about 9 years ago

already tried /etc, did not work. I switch to the Bitnami stack, works as designed.

RE: mail configuration not working - Added by Radek Suski about 9 years ago

Hi Guys,

I had similar problem with Redmine on Ubuntu 10.04. Anyway I needed to set the SMTP server.
It seems that the version from Ubuntu repos has some problems with emails.
I fixed it by replacing the file "config/initializers/40-email.rb" with the same file from original Redmine 0.9.4 package and now it works fine.
Thanks to Felix for the idea.

Best regards,
Radek

RE: mail configuration not working - Added by agilis -- about 9 years ago

Was hitting the same problem on ubuntu 10.4 also, then looked at 40-email.rb

The culprit was this:

filename = ENV['RAILS_ETC'] ? File.join(ENV['RAILS_ETC'], 'email.yml') : File.join(File.dirname(FILE), '..', 'email.yml')

It's looking for email.yml in the /etc/redmine area (part of the package's layout), not the default config/
moving email.yml /etc/redmine/default/ made it work

(1-11/11)