Project

General

Profile

Actions

Defect #13698

closed

Wrong argument error when sending email notifications after upgrading to 2.3.0

Added by Mike Johnson over 11 years ago. Updated almost 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Email notifications
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

Email notifications were working yesterday. I upgraded to Redmine 2.3.0 last night, and today I noticed email notifications weren't being sent out. I tried to send a test email and received the following error message:

An error occurred while sending mail (wrong argument (Fixnum)! (Expected kind of OpenSSL::SSL::SSLContext))

I checked my configuration.yml to make sure it was copied over from the earlier version (2.1.2), and it was:

production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: ourdomain.mail.eo.outlook.com
      port: 25
      domain: redmine.ourdomain.com

I have tried changing the delivery method to async_smtp but received the same error message. As you can see from the configuration, there is no SSL/TLS and no authentication. I also tried changing the domain name to a non-existant name, and received the same error.

Here is my environment information:

Server OS: FreeBSD 9.
Redmine version: 2.3.0.stable
Ruby version: 1.8.7 (amd64-freebsd9)
Rails version: 3.2.13
Environment: production
Database adapter: MySQL


Files

Firefox.png (12.1 KB) Firefox.png Sebastián Moreno, 2013-04-11 16:19

Related issues

Related to Redmine - Defect #14174: email sendding problem when update 2.2.3 to 2.3.1 and 2.3.0 to 2.3.1Closed

Actions
Related to Redmine - Defect #15775: Email delivery error: wrong argument (Fixnum)! (Expected kind of OpenSSL::SSL::SSLContext)Closed

Actions
Actions #1

Updated by Mike Johnson over 11 years ago

  • Status changed from New to Resolved

This just started working on it's own somehow. I have no idea what the problem was :(

Actions #2

Updated by Toshi MARUYAMA over 11 years ago

  • Status changed from Resolved to Closed

Thank you for your feedback.

Actions #3

Updated by Sebastián Moreno over 11 years ago

Hey guys, I'm running on the exact same problem. I upgraded to 2.3.0 and mail just stopped working.

Email Configuration:

default:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: mail.domain.com
port: 25
domain: "domain.com"
authentication: :login
user_name: "no-reply@domain"
openssl_verify_mode: "none"

I don't even know were to look. :(

Server OS: Debian Squeeze 6.0.6.
Redmine version: 2.3.0.stable
Ruby version: ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]
Rails version: 3.2.13
Environment: production
Database adapter: MySQL

Thanks!

Actions #4

Updated by Toshi MARUYAMA over 11 years ago

  • Status changed from Closed to Reopened
Actions #5

Updated by Sebastián Moreno over 11 years ago

There is anything I can do to give you more information? Some kind of log or something?

Actions #6

Updated by Etienne Massip over 11 years ago

Try sending a test email from Administration/Settings tab and have a lokk to your production.log contents.

Actions #7

Updated by Sebastián Moreno over 11 years ago

Ok, I did it, but there is nothing related to the send mail error, just the rendering of the page and sql queries.

Actions #8

Updated by Etienne Massip over 11 years ago

  • Status changed from Reopened to Closed
  • Resolution set to Invalid

Move your settings from the default entry to the production one (at the end of the file).

Actions #9

Updated by Sebastián Moreno over 11 years ago

Changed to this:

production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: mail.********..com
      port: 25
      domain: "********..com" 
      authentication: :login
      user_name: "no-reply@********.com" 
      password: "******" 
      openssl_verify_mode: "none" 

Nothing happened, same error.

I don't have any other configuration on the file. If I change (for example the last line: openssl_verify_mode) the error is different (a previous mailer error) so I think it's using correctly the config.

Actions #10

Updated by Toshi MARUYAMA over 11 years ago

  • Status changed from Closed to Reopened
Actions #11

Updated by Toshi MARUYAMA over 11 years ago

  • Resolution deleted (Invalid)
Actions #12

Updated by Toshi MARUYAMA over 11 years ago

Actions #13

Updated by Etienne Massip over 11 years ago

I think Toshi is right, I didn't see your screenshot in the first place.

Actions #14

Updated by Sebastián Moreno over 11 years ago

Perfect! It works! Thanks a lot guys :)

Actions #15

Updated by Etienne Massip over 11 years ago

  • Status changed from Reopened to Closed
  • Resolution set to Invalid
Actions #16

Updated by Jorge Cabrera over 11 years ago

Hi, I'm having the same problem after upgrading to 2.3.1. Toshi's solution didn't work on my case because Exchange Online requires TLS. I opened an issue with this (#37885). Can someone please guide me on how to solve this problem? My configuration is this:

production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      enable_starttls_auto: true
      address: "pod51016.outlook.com" 
      port: '587'
      authentication: :login
      user_name: "theuser@thedomain" 
      password: "thepassword" 
Actions #17

Updated by Jean-Philippe Lang over 11 years ago

First, try to remove the quotes around the port then restart Redmine.

Actions #18

Updated by Artur Smolarek over 11 years ago

I can confirm Jorge's problem. I have already updated Redmine to 2.3.1.

My e-mail configuration looks like:

default:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: "xyz.com" 
      port: 587
      authentication: :login
      user_name: "user@xyz.com" 
      password: "mypasswd" 
      enable_starttls_auto: true

Output of the mail test:

An error occurred while sending mail (wrong argument (NilClass)! (Expected kind of OpenSSL::SSL::SSLContext))

I tried also to install "always_verify_ssl_certificates" gem but without any positive results.

Any idea?

Actions #19

Updated by Rodrigo Braz over 11 years ago

I still have the same problem as above, no recommended fix worked.
Stopped working after the update to 2.3, and I'm using settings for a google apps email.

I think it has something to do with the openssl_verify_mode property. I have it set to

openssl_verify_mode: 'none'

but if I remove the line the error changes to wrong argument (NilClass) instead of (FixNum).

Actions #20

Updated by BTR Naidu over 11 years ago

Same error here. Any more ideas guys?

Actions #21

Updated by Oscar Moncada over 11 years ago

I'm having a similar issue, just updated to version 2.3.1 and I can't get the notification emails to work.

I get the following error:

An error occurred while sending mail (wrong argument (NilClass)! (Expected kind of OpenSSL::SSL::SSLContext))

This is my configuration:

production:
   email_delivery:
     delivery_method: :smtp
     smtp_settings:
       address: smtp.gmail.com
       port: 587
       domain: smtp.gmail.com
       authentication: :plain
       user_name: my.address@my-domain.com
       password: mypassword

This is my redmine environment:

Environment:
  Redmine version                          2.3.1.stable
  Ruby version                             1.8.7 (x86_64-linux)
  Rails version                            3.2.13
  Environment                              production
  Database adapter                         Mysql2
Redmine plugins:
  no plugin installed

I've tried everything from switching to async_smtp (which generates a success message but does not send out the email) to setting enable_starttls_auto to false (which generates a different error message that says I must set the starttls first) to using/not using quotes on the username and password parameters, etc. Nothing seems to work :-(

Any help would be greatly appreciated!

Actions #22

Updated by Dmitry Glavchev over 11 years ago

I managed somehow to resolve this for non-SSL/TLS case. Not sure how exactly, I was just playing with config and was going to debug ruby gems responsible for mail delivery but suddenly it just started sending emails. My Redmine is 2.3.1-devel and here is my email config:

default:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      enable_starttls_auto: false
      address: smtp.someserver.com
      port: 25
      authentication: :login
      user_name: usernameWithoutQuotes
      password: passwordWithoutQuotes
      openssl_verify_mode: 'none'

Please also note that I've added same email_delivery stuff in production: section in the end of the file configuration.yml.

Certainly some of those configuration settings helped but now I don't want to touch anything :) let it just work.

After changing config restart your Redmine webserver, it looks like ruby scripts can be heavily cached.

Actions #23

Updated by BTR Naidu over 11 years ago

Did you use gmail smtp server? I see you are using port 25. Guess gmail does not use port 25?

Actions #24

Updated by Anonymous over 11 years ago

I use sendmail function on CentOS 5.8 final, but I also have the same problem. On setting in Administrator, I used "send test email" And redmine said "sent sucessfull" but I did not receive any email

Actions #25

Updated by BTR Naidu over 11 years ago

Any update guys? Anybody had similar issue before and were able to resolve?

Actions #26

Updated by XDjuj Apsulis over 11 years ago

Like answered before, the fix is here :
- http://www.redmine.org/boards/2/topics/37008

Juste change "openssl_verify_mode 'none'" with "enable_starttls_auto: false" in your config/configuration.xml file.

In my simple case, it now works with :

# default configuration options for all environments
default:
  # Outgoing emails configuration (see examples above)
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: localhost
      port: 25
      domain: mydomain.com           
      enable_starttls_auto: false
     # openssl_verify_mode: 'none' ==> this line is not working anymore on redmine 2.3.x
     # authentication: :login
     # user_name: "redmine@example.net" 
     # password: "redmine" 

  # Absolute path to the directory where attachments are stored.

Actions #27

Updated by Rodrigo Braz over 11 years ago

XDjuj Apsulis wrote:

Like answered before, the fix is here :
- http://www.redmine.org/boards/2/topics/37008

Juste change "openssl_verify_mode 'none'" with "enable_starttls_auto: false" in your config/configuration.xml file.

In my simple case, it now works with :
[...]

This is not a solution. Some email config require tls, which is the case of gmail, so setting it to false won't work anyway.

Removing "openssl_verify_mode" and setting "enable_starttls_auto: true" will give the following error

An error occurred while sending mail (wrong argument (NilClass)! (Expected kind of OpenSSL::SSL::SSLContext))

Actions #28

Updated by Oscar Moncada over 11 years ago

I tried making those changes and still get the same error as before. Has anyone gotten this to work with gmail?

Actions #29

Updated by Peter Panther over 11 years ago

The problem

An error occurred while sending mail (wrong argument (NilClass)! (Expected kind of OpenSSL::SSL::SSLContext))

ist caused by the gem package 'mail' in version 2.5.4 (released on the 14th of may 2013)
(for further details have a look at https://github.com/mikel/mail/issues/548)

All Redmine installations/updates after this date will have the TLS-negotiation problem if ruby 1.8.7 is still used.
Downgrade to version 2.5.3 and TLS-encryption works as before......

Actions #30

Updated by Mikael Nehlsen over 11 years ago

I also have this problem, A small question for a non fluent ruby speaker. how do you downgrade mail I did

gem install mail -v 2.5.3
gem uninstall mail -v 2.5.4

but then I got a nice big error in my redmine installation saying something like this:

Could not find mail-2.5.4 in any of the sources (Bundler::GemNotFound)

Actions #31

Updated by Mikael Nehlsen over 11 years ago

Being impatient I tried some things and found out that what did work was

gem install mail -v 2.5.3

edit the file Gemfile.lock in the redmine root dir update from mail (2.5.4) to mail (2.5.3) and restart in my case apache.

Actions #32

Updated by Oscar Moncada over 11 years ago

Downgrading to mail -v 2.5.3 fixed the issue for me. THANK YOU!!!!

Actions #33

Updated by Anonymous over 11 years ago

This solution is not work for me. Downgrading to 2.5.3 the problem is not change. Please view my issue at: http://www.redmine.org/boards/2/topics/37850

Actions #34

Updated by Kuba Zwolinski over 11 years ago

Downgrading mail worked for me, thanks.

Actions #35

Updated by Tomas Latal over 11 years ago

Downgrading to mail 2.5.3 and changing dependency in Gemfile.lock from mail 2.5.4 to 2.5.3 worked for me too. Thank you.

Actions #36

Updated by Christian Rost over 11 years ago

Mikael Nehlsen wrote:

Being impatient I tried some things and found out that what did work was
gem install mail -v 2.5.3
edit the file Gemfile.lock in the redmine root dir update from mail (2.5.4) to mail (2.5.3) and restart in my case apache.

That did it - downgraded mail to 2.5.3; changed mail dependency in Gemfile.lock to 2.5.3; restarted apache; notification mails are sent again. ;-)

Actions #37

Updated by Raphael PRIVAT over 11 years ago

Hello,

I had the same problem with my gmail account and downgrading to 2.5.3 worked.
BUT ... It only works with gmail !

I have a mail server with TLS that I used to access from an older Redmine version (2.1.2 , mail 2.4.4) and everything worked.
Now, with the same configuration.yml (2.3.2, mail 2.5.3 or 2.5.4) it doesn't work.

smtp_settings:
enable_starttls_auto: true
openssl_verify_mode : 'none'
address: "mail.mydomain.com"
port: 587
domain: "mydomain.com"
authentication: :plain
user_name: user@mydomain.com
password: userpass

My certificate is auto signed so I have to set openssl_verify_mode : 'none' and TLS is mandatory.
user and password quoted or unquoted, nothing will do the trick.

Did someone manage to use a TLS account other than GMail ?

Actions #38

Updated by Vladimir Skubriev over 11 years ago

My certificate is auto signed so I have to set openssl_verify_mode : 'none' >and TLS is mandatory.
user and password quoted or unquoted, nothing will do the trick.

I think that it is not ruby mail 2.5.4 problem.

I think that problem is you own Certificate Authority is not trusted by a redmine server system running.

google: update-ca-certificates and other methods to add ca to system store /etc/ssl

Actions #39

Updated by Vladimir Skubriev about 11 years ago

I changed the setting "tls" to false and it worked.

See part of my configuration.yml

# default configuration options for all environments
default:
  # Outgoing emails configuration (see examples above)
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
     tls: false
      enable_starttls_auto: true
      address: "smtp.yandex.ru" 
      port: '587'
      domain: mydomainatyandex.com
      authentication: :plain
      user_name: "user@mydomainatyandex.com" 
      password: "pass" 

Also this work with 2.5.3 and 2.5.4 mail gem version.
I suspect that the port is not significant. You can use 25 or 587 with yandex. With google best way to use 587 port.
Actions #40

Updated by Adrien Crivelli about 11 years ago

Same here, ran sudo gem install mail -v 2.5.3 and edited Gemfile.lock manually to re-enable email notifications.

In my opinion this issue should not be closed until a new mail version is released, which would actually fix the bug.

Actions #41

Updated by Yuri Yurip about 11 years ago

Hello people,

I will to become crazy with this mail notification !
I always get this error message:

Erreur lors de l'envoi de l'email (wrong argument (NilClass)! (Expected kind of OpenSSL::SSL::SSLContext))

Already try to:

-Downgrade mail version to 2.5.3.
-Change configuration file with different parameters

My config:

Ubuntu 12.x LTS 64 bit under VM

Environment:
Redmine version 2.3.3.stable
Ruby version 1.8.7-p352 (2011-06-30) [x86_64-linux]
Rails version 3.2.13
Environment production
Database adapter MySQL
Redmine plugins:
no plugin installed

My configuration.yml file:

production:
email_delivery:
delivery_method: :smtp
smtp_settings:
enable_starttls_auto:false
openssl_verify_mode: 'none'
address: "smtp.gmail.com"
port: '587'
domain: "smtp.gmail.com"
authentication: :plain
user_name: email_name
password: my_password

Any help will be apreciated thank !

Actions #42

Updated by Сергей Нерволь about 11 years ago

All work fine.

apt-cache policy ruby1.9.3
ruby1.9.3:
Установлен: 1.9.3.0-1ubuntu2.7
Кандидат: 1.9.3.0-1ubuntu2.7

Environment:
Redmine version 2.3.3.stable
Ruby version 1.8.7-p352 (2011-06-30) [x86_64-linux]
Rails version 3.2.13
Environment production
Database adapter PostgreSQL
Redmine plugins:
no plugin installed

My actions to make it works:

  1. Changed Gemfile.lock: changed line mail (2.5.4) --> mail (2.5.3)
  2. gem install mail -v 2.5.3
  3. gem uninstall mail -v 2.5.4
  4. service apache2 restart

cat ./configuration.yml

production:
  delivery_method: :smtp
  smtp_settings:
    enable_starttls_auto: true
    address: smtp.gmail.com
    port: 587
    domain: "my.domain" 
    authentication: :login
    user_name: "robot@my.domain" 
    password: "password" 

Actions #43

Updated by Erlend ter Maat about 11 years ago

When I downgrade mail to 2.5.3 a dependency for actionmailer breaks.

How can I downgrade "mail" without breaking the dependency?

Actions #44

Updated by Plam Sim about 11 years ago

Downgrade to 2.5.3 and changing dependencies in "Gemfile.lock" - 2 rows for mail.
However only after implementing the right syntax described in http://www.redmine.org/boards/2/topics/30670 worked for me.
Redmine 2.4.1 with Gmail SMTP method.

Actions #45

Updated by Jan from Planio www.plan.io almost 11 years ago

  • Related to Defect #15775: Email delivery error: wrong argument (Fixnum)! (Expected kind of OpenSSL::SSL::SSLContext) added
Actions #46

Updated by Miquel Coll over 10 years ago

Mikael Nehlsen wrote:

Being impatient I tried some things and found out that what did work was

gem install mail -v 2.5.3

edit the file Gemfile.lock in the redmine root dir update from mail (2.5.4) to mail (2.5.3) and restart in my case apache.

Thanks! This also worked for me. I'm using redmine 2.4.5 and a Gmail account in configuration.yml.

Actions #47

Updated by Alexander Dunin about 10 years ago

My settings for mandrill

email_delivery:
  delivery_method: :smtp
  smtp_settings:
    address: "smtp.mandrillapp.com" 
    port: 587
    domain: "smtp.mandrillapp.com" 
    authentication: :plain
    user_name: "username@example.com" 
    password: "password" 
    openssl_verify_mode: OpenSSL::SSL::VERIFY_NONE
    enable_starttls_auto: false
Actions #48

Updated by Jin Ma about 10 years ago

My Redmine version is 2.6.0
When I configure my email, I got an error:
Email delivery error: wrong argument (Fixnum)! (Expected kind of OpenSSL::SSL::SSLContext)

here is my configs

production:
  delivery_method: :smtp
  smtp_settings:
    ssl: true
    enable_starttls_auto: true
    openssl_verify_mode: 'none'
    address: "smtp.exmail.qq.com" 
    port: 465 
    domain: "zuinianqing.com" 
    authentication: :login
    user_name: "redmine@zuinianqing.com" 
    password: "XXXXXXX" 

Could you help me?

Actions #49

Updated by Allen Huang almost 10 years ago

I found the solution from http://www.parorrey.com/blog/project-management/redmine-email-configuration-resolve-sending-email-notifications/ works for me.
The key is adding followings to configuration.yml file

      enable_starttls_auto: false
      openssl_verify_mode: none

Actions

Also available in: Atom PDF