ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

Error when sending test mail

Added by Thomas Bednarz at 2012-05-06 10:46 am

Hi,

I did a fresh install of Chili on CentOS 5.8. The base config seems to work, at least I can login, add users etc. I tried to setup mail. But that does not work, whatever configuration I try. I use production with the following settings in configuration.yml:

production:
email_delivery:
delivery_method: :smtp
smtp_settings:
enable_starttls_auto: true
address: "mailhost.mydomain.com"
port: 587
authentication: :plain
user_name: ""
password: "mypassword"

of course with correct host-, username and password.

My mailhost is on a different server and runs iredmail (http://www.iredmail.org) which is built of postfix, dovecot and all that other basic LINUX mail stuff.

I also tried local sendmail, which should work on my CentOS. The error message I get is no matter which configuration I use:

An error occurred while sending mail (undefined method `perform_delivery_production' for #)

Also production.log is empty!!

Any idea what goes wrong here?


Replies (10)

RE: Error when sending test mail - Added by Felix Schäfer at 2012-05-17 07:20 pm

Hi Thomas, sorry for the delay :-/

Thomas Bednarz wrote:

Any idea what goes wrong here?

Do you have any plugins installed? Which version of ruby are you on? Have you remembered to restart the app after making changes to the configuration.yml? If you comfortable with it, could you go to your ChiliProject directory, launch the console (script/console production -s) and see what Redmine::Configuration['email_delivery'] returns?

RE: Error when sending test mail - Added by Thomas Bednarz at 2012-05-18 12:43 pm

Hi Felix,

Ruby Version:

[root@saturn ~]# ruby -v
ruby 1.8.7 (2012-02-08 MBARI 8/0x6770 on patchlevel 358) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2012.02

No plugins, it is a plain vanilla install

I restarted httpd several times

I am not familiar with Ruby at all. I am a Java, Groovy on Grails, .NET, C++, etc person, never used Ruby or Rails for anything before. It took me a lot of research to get the blody thing installed and running! I think there must be missing someting, but no idea what! I used RVM to install ruby, so I used
rvm install ree
to install it. Then I did:

gem install passenger
passenger-install-apache2-module

To get the chiliproject I did:

git clone -b stable git://github.com/chiliproject/chiliproject.git
cd chiliproject
bundle install --without=test development sqlite postgres mysql rmagick

I moved the whole thing to the place where I have all my web apps (/var/www) by creating a sub-dir (chiliproject) like this:
cd /var/www
cp -R /root/projects/chiliproject /var/www/chiliproject
chown -R apache:apache ./chiliproject

Then I changed my httpd.conf file accordingly as well as the configuration files (those .yml ones) according to several articles in the wiki.

If I enter the command you wrote above I get:


[root@saturn script]# ./console production -s
Loading production environment in sandbox (Rails 2.3.14)
Any modifications you make will be rolled back on exit
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /usr/local/rvm/gems/ree-1.8.7-2012.02/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21.
/usr/local/rvm/gems/ree-1.8.7-2012.02/gems/rails-2.3.14/lib/initializer.rb:926:in `read':Errno::ENOENT: No such file or directory - /root/chiliproject/config/database.yml
/usr/local/rvm/gems/ree-1.8.7-2012.02/gems/activerecord-2.3.14/lib/active_record/connection_adapters/abstract/connection_pool.rb:326:in `retrieve_connection':ActiveRecord::ConnectionNotEstablished: ActiveRecord::ConnectionNotEstablished
/usr/local/rvm/gems/ree-1.8.7-2012.02/gems/activesupport-2.3.14/lib/active_support/dependencies.rb:131:in `const_missing':NameError: uninitialized constant Redmine::Scm::Adapters::AbstractAdapter::RAILS_DEFAULT_LOGGER

If I add the redmain command I get:

>> Redmine::Configuration['email_delivery']
=> nil

Just to clarify: in the directory /var/www/chiliproject/config I changed several .yml configuration files. I basically copied the .yml.example ones to .yml and made the changes there. For Email I changed configuration.yml as follows:

production:
email_delivery:
delivery_method: :smtp
smtp_settings:
enable_starttls_auto: true
address: "<fully qualified name of mail server like mail.mydomain.com>"
port: 587
authentication: :plain
user_name: "<myusername>"
password: "<mypassword>"

The Mailserver is a different machine on the same networksegment.

Any help would be greatly apreciated!

Thomas

RE: Error when sending test mail - Added by Felix Schäfer at 2012-05-18 03:37 pm

Thomas Bednarz wrote:

[root@saturn ~]# ruby -v
ruby 1.8.7 (2012-02-08 MBARI 8/0x6770 on patchlevel 358) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2012.02

Looking good.

No plugins, it is a plain vanilla install

Still good.

I restarted httpd several times

And still good. Restarting apache restarts passenger with it, a reload would be enough too. With passenger you can even just touch tmp/restart.txt in your rails app folder (in this case the chiliproject folder) for passenger to restart that particular app on the next request.

I think there must be missing someting, but no idea what!

No, all seems good even with the installation, the problem probably is with some config/path snafu.

If I enter the command you wrote above I get:

/usr/local/rvm/gems/ree-1.8.7-2012.02/gems/rails-2.3.14/lib/initializer.rb:926:in `read':Errno::ENOENT: No such file or directory - /root/chiliproject/config/database.yml

So there's something: it looks for the file /root/chiliproject/config/database.yml, which tells me you've picked the wrong script/console to run :-) If you have installed ChiliProject in /var/www/chiliproject, please also run the command there.

Just to clarify: in the directory /var/www/chiliproject/config I changed several .yml configuration files. I basically copied the .yml.example ones to .yml and made the changes there. For Email I changed configuration.yml as follows:

The config looks good so far, the problem is probably somewhere else. The commands above start an interactive shell with ChiliProject loaded (the script/console) part, the command with the Redmine::Configuration is exactly where the mailer gets its config from, so by inspecting what's in there I hope to be able to help you correct the problem :-)

RE: Error when sending test mail - Added by Thomas Bednarz at 2012-05-21 06:48 am

OK I started from my root home directory where I downloaded and compiled the whole thing. Here the output from the /var/www/chiliproject directory:

[root@saturn script]# ./console production -s
Loading production environment in sandbox (Rails 2.3.14)
Any modifications you make will be rolled back on exit
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /usr/local/rvm/gems/ree-1.8.7-2012.02/gems/rails-2.3.14/lib/rails/gem_dependency.rb:21.

Redmine::Configuration['email_delivery']

=> {"delivery_method"=>"production"}

Any suggestions?

RE: Error when sending test mail - Added by Felix Schäfer at 2012-05-21 06:55 am

Thomas Bednarz wrote:

Any suggestions?

Yes, have a look at the config file for your installation (i.e. /var/www/chiliproject/config/configuration.yml) and make sure it is correct. The output of the above command should look something like:

{"smtp_settings"=>{:address=>"smtp.example.net", :port=>25, :domain=>"example.net", :user_name=>"chiliproject@example.net", :password=>"chiliproject", :authentication=>:login}, "delivery_method"=>:smtp}

(Notice the "delivery_method"=>:smtp at the end, which tells the mail subsystem to use smtp, you have production there, which the mailer can't make heads or tails of)

RE: Error when sending test mail - Added by Thomas Bednarz at 2012-05-21 07:35 am

Hmm I think I need some more help. I followed the instructions on page [[https://www.chiliproject.org/projects/chiliproject/wiki/Email_Delivery#SMTP-server-using-TLS-GMail]]. If I remove all the comments from the configuration.yml file I have only the following:

@
production:
email_delivery:
delivery_method: :smtp
smtp_settings:
enable_starttls_auto: true
address: "mailserver.mydomain.com"
port: 587
authentication: :plain
user_name: ""
password: "the password"

attachments_storage_path:
themes_storage_path:

autologin_cookie_name:
autologin_cookie_path:
autologin_cookie_secure:
scm_subversion_command:
scm_mercurial_command:
scm_git_command:
scm_cvs_command:
scm_bazaar_command:
scm_darcs_command:
database_cipher_key:
  1. specific configuration options for production environment
  2. that overrides the default ones
    production:
    email_delivery:
    delivery_method: production
  3. specific configuration options for development environment
  4. that overrides the default ones
    development:
  1. Configuration for the test environment
    test:
    email_delivery:
    delivery_method: test
    @

OK, I don't know anything about yml files and what is behind it. But if I compare it to XML production: seems to be like a tag. It is written twice and it looks like you can repeat the tags as many times as you want, it takes the last one. So I removed the second production: at the bottom of the file. Now the output looks better, it shows the configuration of the first production label/tag.

However when logging back to the application and trying to send a testmail I still get an error. Now it says:
An error occurred while sending mail (501 Syntax: HELO hostname )

As address I gave the fully qualified host name but also tried the IP only. The output looks like this:


Redmine::Configuration['email_delivery']
=> {"smtp_settings"=>{:address=>"10.63.63.70", :port=>587, :password=>"mypassword", :user_name=>"account@mydomain.com", :authentication=>:plain, :enable_starttls_auto=>true}, "delivery_method"=>:smtp}

The call gets to my mail server. In the maillog I see:

May 21 09:31:16 uranus postfix/smtpd[20617]: connect from unknown[10.63.63.80]
May 21 09:31:16 uranus postfix/smtpd[20617]: lost connection after HELO from unknown[10.63.63.80]
May 21 09:31:16 uranus postfix/smtpd[20617]: disconnect from unknown[10.63.63.80]

To me that looks like more information to login is required or the information provided is not recognised. Any idea what could be wrong here?

RE: Error when sending test mail - Added by Felix Schäfer at 2012-05-21 12:14 pm

(On a side-note: for multi-line code/pastes, use the < pre>< /pre> (spaces added, remove before use) tags, the @-tags don't work multi-line)

Thomas Bednarz wrote:

OK, I don't know anything about yml files and what is behind it. But if I compare it to XML production: seems to be like a tag. It is written twice and it looks like you can repeat the tags as many times as you want, it takes the last one. So I removed the second production: at the bottom of the file. Now the output looks better, it shows the configuration of the first production label/tag.

I think this style of "tagging" stuff in a yml file is rather Redmine/ChiliProject-specific (and something we'll probably remove sometime in the middle future to stick to yml standards), yml does support "tags" of sorts with the & and * sigils (see yaml on wikipedia).

The output looks like this:

This looks all good now indeed.

However when logging back to the application and trying to send a testmail I still get an error. Now it says:
An error occurred while sending mail (501 Syntax: HELO hostname )

Try adding the domain: mydomain.com key to your smtp_settings (on the same level as port: and so on), some servers require that.

Anyway, this is definitely a step forward as the error is cast by the mail server :-)

RE: Error when sending test mail - Added by Thomas Bednarz at 2012-05-21 01:26 pm

This seems to be an endless story ....

I added the domain: tag

The error message is now different


An error occurred while sending mail (hostname was not match with the server certificate)

Postfix writes in maillog:
May 21 15:20:46 uranus postfix/smtpd4843: connect from unknown[10.63.63.80]
May 21 15:20:46 uranus postfix/smtpd4843: lost connection after STARTTLS from unknown[10.63.63.80]
May 21 15:20:46 uranus postfix/smtpd4843: disconnect from unknown[10.63.63.80]

How can I import a certificate in Ruby??? Or can I force it NOT to use TLS? authentication is set to plain, whatever that means....

RE: Error when sending test mail - Added by Thomas Bednarz at 2012-05-21 01:50 pm

Finally got it working!

Just commented the line

enable_starttls_auto: true

Since I allowed relay for some internal adresses it must have worked!

Thanks for your support!

RE: Error when sending test mail - Added by Felix Schäfer at 2012-05-21 02:49 pm

Thomas Bednarz wrote:

Finally got it working!

Sounds great. Yeah, emails and email servers are finicky things :-/

(1-10/10)