ActionMailer: "Email delivery error" since version 4.1.1

Added by Nono Nono over 1 year ago

Edit 28/05/2020: Adding a fourth error
Dear forum,

I've upgraded my Redmine 3.4.11 to 4.1.1 a week ago and all went fine expect with email notification.
I'm facing an sporadic issue: some emails goes out perfectly, and some others don't, and gave me one of the three four following errors:

[ActiveJob] [ActionMailer::DeliveryJob] [xxx] Email delivery error: SSL_read: wrong version number
[ActiveJob] [ActionMailer::DeliveryJob] [xxx] Email delivery error: SSL_connect returned=1 errno=0 state=error: wrong version number
[ActiveJob] [ActionMailer::DeliveryJob] [xxx] Email delivery error: Net::OpenTimeout
[ActiveJob] [ActionMailer::DeliveryJob] [xxx] Email delivery error: end of file reached

System information:

$ rvm current
ruby-2.6.0

$ rails --version
Rails 5.2.4.2

$ ruby --version
ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]

$ bundle --version
Bundler version 2.1.4

$ uname -r
4.15.0-99-generic

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS" 

OpenSSL> version
OpenSSL 1.1.1  11 Sep 2018

$ mysql --version
mysql  Ver 14.14 Distrib 5.7.30, for Linux (x86_64) using  EditLine wrapper

database.yml:
production:
  adapter: mysql2

configuration.yml:
delivery_method: :smtp
    smtp_settings:
      enable_starttls_auto: true
      address: xxx
      port: 587
      domain: xxx
      #authentication: :plain
      authentication: :login
      user_name: "xxx" 
      password: "xxx" 
      openssl_verify_mode: 'none'

The "authentication" field was a try (without major changes) found in the only related post I found here: https://redmine.org/boards/2/topics/37326?r=38529#message-38529

Replies (10)

RE: ActionMailer: "Email delivery error" since version 4.1.1 - Added by Marius BALTEANU over 1 year ago

Redmine 4.0.0 brings a major change on how the notification emails are sent, please see #26791 for details. After this change, if you don't setup a production ready backend for your queue, you can have issues like this #32314#note-17.

RE: ActionMailer: "Email delivery error" since version 4.1.1 - Added by Nono Nono over 1 year ago

Thanks Marius,

Indeed, I must have miss this information / changelog.

As I'm not a redmine/ruby/rails expert, is there any specific 'redmine' documentation or how-to to setup a backend like sidekiq aside this link: https://guides.rubyonrails.org/v5.2/active_job_basics.html#job-execution

I'm really not feeling confortable to edit the redmine code, without the risk to break everything.

The current workaround was to add those lines, before the "end end" in config/application.rb and seems to (slowdown a bit redmine but) works :

config.active_job.queue_adapter = :inline

Note: we are a 10 users redmine instance

RE: ActionMailer: "Email delivery error" since version 4.1.1 - Added by Marius BALTEANU over 1 year ago

I have just created a wiki page with the instructions for Ubuntu 18.04, please take a look SideqikConfiguration. The changes are quite safe because you don't need to change the Redmine code, you only change the configuration.

Let us know in #33589 if it works for you.

RE: ActionMailer: "Email delivery error" since version 4.1.1 - Added by David Doležal 11 months ago

Is it possible to solve it under Windows-server? My configuration:

Environment:
Redmine version 4.1.1.stable
Ruby version 2.6.6-p146 (2020-03-31) [x64-mingw32]
Rails version 5.2.4.2
Environment production
Database adapter Mysql2
Mailer queue ActiveJob::QueueAdapters::AsyncAdapter
Mailer delivery smtp

RE: ActionMailer: "Email delivery error" since version 4.1.1 - Added by David Doležal 11 months ago

Hi,
can somebody help me please? After update from 3.4.6 I have problem with email notification. I tried Sidekiq, Inline, Async, and quite good is Sucker_Punch

I install sucker_punch as gem and use it with active job and sometime I don't receive notification. For example in attachment is log, wher 3 emails arrived, this one no.

My setup
WINDOWS SERVER 2016

Environment:
Redmine version 4.1.1.stable
Ruby version 2.6.6-p146 (2020-03-31) [x64-mingw32]
Rails version 5.2.4.2
Environment production
Database adapter Mysql2
Mailer queue ActiveJob::QueueAdapters::SuckerPunchAdapter
Mailer delivery smtp
SCM:
Filesystem
Redmine plugins:
redmine_custom_workflows 1.0.3
redmine_lightbox2 0.5.0

My config\configuration.yml:

  1. specific configuration options for production environment
  2. that overrides the default ones
    production:
    email_delivery:
    delivery_method: :smtp
    smtp_settings:
    address: "<smtp_server_via_DNS_name>"
    port: 25
    domain: '<domain>'
    authentication: :login
    user_name: '<user>'
    password: '<pass>'
    openssl_verify_mode: 'none'

I spent with it 2 days and nothing... :-(

sp-crash.JPG (83.8 KB)

RE: ActionMailer: "Email delivery error" since version 4.1.1 - Added by David Doležal 11 months ago

Sorry, my setup again and better

My setup

Environment:
  Redmine version                4.1.1.stable
  Ruby version                   2.6.6-p146 (2020-03-31) [x64-mingw32]
  Rails version                  5.2.4.2
  Environment                    production
  Database adapter               Mysql2
  Mailer queue                   ActiveJob::QueueAdapters::SuckerPunchAdapter
  Mailer delivery                smtp
SCM:
  Filesystem                     
Redmine plugins:
  redmine_custom_workflows       1.0.3
  redmine_lightbox2              0.5.0

My config\configuration.yml:

# specific configuration options for production environment
# that overrides the default ones
production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: "<smtp_server_via_DNS_name>" 
      port: 25
      domain: '<domain>'
      authentication: :login
      user_name: '<user>'
      password: '<pass>' 
      openssl_verify_mode: 'none'

RE: ActionMailer: "Email delivery error" since version 4.1.1 - Added by David Doležal 11 months ago

So here is point:

I send 5 email correctly, 6th crash with. Here is log from production.log.

2430: [ActiveJob] Enqueued ActionMailer::DeliveryJob (Job ID: 026f2039-2754-4836-abfe-d93bbec43f76) to SuckerPunch(mailers) with arguments: "Mailer", "issue_edit", "deliver_now", #<GlobalID:0x000000000ede0388 @uri=#<URI::GID gid://redmine-app/User/5>>, #<GlobalID:0x000000000edeba80 @uri=#<URI::GID gid://redmine-app/Journal/7027>>
2434: [ActiveJob] [ActionMailer::DeliveryJob] [026f2039-2754-4836-abfe-d93bbec43f76] Performing ActionMailer::DeliveryJob (Job ID: 026f2039-2754-4836-abfe-d93bbec43f76) from SuckerPunch(mailers) with arguments: "Mailer", "issue_edit", "deliver_now", #<GlobalID:0x000000000ee11b68 @uri=#<URI::GID gid://redmine-app/User/5>>, #<GlobalID:0x000000000ee11320 @uri=#<URI::GID gid://redmine-app/Journal/7027>>
2436: [ActiveJob] [ActionMailer::DeliveryJob] [026f2039-2754-4836-abfe-d93bbec43f76]   Rendering mailer/issue_edit.text.erb within layouts/mailer
2440: [ActiveJob] [ActionMailer::DeliveryJob] [026f2039-2754-4836-abfe-d93bbec43f76]   Rendered mailer/_issue.text.erb (8.7ms)
2441: [ActiveJob] [ActionMailer::DeliveryJob] [026f2039-2754-4836-abfe-d93bbec43f76]   Rendered mailer/issue_edit.text.erb within layouts/mailer (9.5ms)
2442: [ActiveJob] [ActionMailer::DeliveryJob] [026f2039-2754-4836-abfe-d93bbec43f76]   Rendering mailer/issue_edit.html.erb within layouts/mailer
2446: [ActiveJob] [ActionMailer::DeliveryJob] [026f2039-2754-4836-abfe-d93bbec43f76]   Rendered mailer/_issue.html.erb (0.7ms)
2447: [ActiveJob] [ActionMailer::DeliveryJob] [026f2039-2754-4836-abfe-d93bbec43f76]   Rendered mailer/issue_edit.html.erb within layouts/mailer (9.9ms)
2470: [ActiveJob] [ActionMailer::DeliveryJob] [026f2039-2754-4836-abfe-d93bbec43f76] Email delivery error: end of file reached
2471: [ActiveJob] [ActionMailer::DeliveryJob] [026f2039-2754-4836-abfe-d93bbec43f76] Performed ActionMailer::DeliveryJob (Job ID: 026f2039-2754-4836-abfe-d93bbec43f76) from SuckerPunch(mailers) in 428.84ms

The same problem I have, when I 6-times click on Send a test mail in settings. 5-times email comes, 6th crash with (czech mutation of Redmine)

Při odesílání emailu nastala chyba (end of file reached) = An error occurred while sending the email (end of file reached)

RE: ActionMailer: "Email delivery error" since version 4.1.1 - Added by David Doležal 11 months ago

So here is solution for my problem!

It was in connector on SMTP server, where was set low limit emails per minute from IP address. So simple! It works with Async and SuckerPunch too.

RE: ActionMailer: "Email delivery error" since version 4.1.1 - Added by Black Zajaz 6 months ago

David Doležal wrote:

So here is solution for my problem!

It was in connector on SMTP server, where was set low limit emails per minute from IP address. So simple! It works with Async and SuckerPunch too.

Hello David,

can you please describe, what you have done?

Which one file or settings has you changed?

RE: ActionMailer: "Email delivery error" since version 4.1.1 - Added by David Doležal 13 days ago

Black Zajaz wrote:

David Doležal wrote:

So here is solution for my problem!

It was in connector on SMTP server, where was set low limit emails per minute from IP address. So simple! It works with Async and SuckerPunch too.

Hello David,

can you please describe, what you have done?

Which one file or settings has you changed?

Hi,
it's difficult to say what exactly was changed. In my situation was it number of emails per minutes which connector can handle. We use external partner for sites solution. But here is more information about Exchange connectors.

https://docs.microsoft.com/en-us/exchange/mail-flow/connectors/connectors?view=exchserver-2016

(1-10/10)