Open robertgarrigos opened 6 years ago
Check errors in the production log and paste them here:
grep ERROR log/production.log -A3 -B3
E, [2018-07-18T18:51:35.456933 #1158] ERROR -- : [ActiveJob] [ActionMailer::DeliveryJob] [65fda941-1a9f-4d38-955d-e724db2761f0] Error performing ActionMailer::DeliveryJob (Job ID: 65fda941-1a9f-4d38-955d-e724db2761f0) from Async(mailers) in 60915.35ms: Net::ReadTimeout (Net::ReadTimeout):
/home/decidim/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/protocol.rb:181:in `rbuf_fill'
/home/decidim/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/protocol.rb:157:in `readuntil'
/home/decidim/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/protocol.rb:167:in `readline'
I thought it was firewall, so I disabled it, but still having this error.
I believe where the problem is: decidim uses starttls to send secure mail thru a non-secure port. I've changed the port to 465, which is the secure port for smtp. I would need to add some settings about using TLS or SSL instead of STARTTLS, but I don't know where to set this.
got it!
Added in /config/environments/production.rb:
config.action_mailer.smtp_settings = {
:address => Rails.application.secrets.smtp_address,
:port => Rails.application.secrets.smtp_port,
:authentication => Rails.application.secrets.smtp_authentication,
:user_name => Rails.application.secrets.smtp_username,
:password => Rails.application.secrets.smtp_password,
:domain => Rails.application.secrets.smtp_domain,
:enable_starttls_auto => Rails.application.secrets.smtp_starttls_auto,
:openssl_verify_mode => 'none',
:ssl => true,
:tls => true
}
and now it's working
That's great! I will link this issue from the doc in the Mail debug section
I also can't achieve to send messages from Decidim. This are my log latest entries:
D, [2019-02-14T09:50:54.511985 #21520] DEBUG -- : Delayed::Backend::ActiveRecord::Job Load (1.1ms) UPDATE "delayed_jobs" SET locked_at = '2019-02-14 08:50:54.510223', locked_by = 'delayed_job host:decidim pid:21520' WHERE id IN (SELECT "delayed_jobs"."id" FROM "delayed_jobs" WHERE ((run_at <= '2019-02-14 08:50:54.509491' AND (locked_at IS NULL OR locked_at < '2019-02-14 04:50:54.509546') OR locked_by = 'delayed_job host:decidim pid:21520') AND failed_at IS NULL) ORDER BY priority ASC, run_at ASC LIMIT 1 FOR UPDATE) RETURNING *
Also a GREP for the term ERROR:
decidim@decidim:~/decidim-app$ grep ERROR log/production.log -A3 -B3
----==_mimepart_5c6500aecb3ac_1c092aed689952c09355--
initialize' /home/decidim/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/smtp.rb:539:in
open'
/home/decidim/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/smtp.rb:539:in `tcp_socket'----==_mimepart_5c6501cf9e282_1c092aed689952c096f6--
E, [2019-02-14T06:51:11.661332 #7177] ERROR -- : [ActiveJob] [ActionMailer::DeliveryJob] [8604e7cf-fc32-424d-8375-0eaf0ca94e24] Error performing ActionMailer::DeliveryJob (Job ID: 8604e7cf-fc32-424d-8375-0eaf0ca94e24) from Async(mailers) in 1083.03ms: Errno::ECONNREFUSED (Connection refused - connect(2) for nil port 587):
/home/decidim/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/smtp.rb:539:in initialize' /home/decidim/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/smtp.rb:539:in
open'
/home/decidim/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/smtp.rb:539:in `tcp_socket'
Do you have any idea? Thank's!
@polnetwork can you access port 587? for example with comman:
nc -zv smtp.server.tld 587
Yes Connection to smtp.gmail.com 587 port [tcp/submission] succeeded! I'v created a specific PWD for the app (as yout told here https://github.com/Platoniq/decidim-install/blob/master/basic-config.md), and also tried with my own SMTP server. How can I force to retry message cue processing after a setup change? Thank you
It's possible your suffering from an error with IPv6 with gmail stmp. Have you tried what's explained in basic-config about disabling IPv6?
Yes, i'd done that:
sudo sysctl -p net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1
I'm testing with other server/ports configurations. What's the best wsy to test if the system is sending messages? Now I'm creating users throught admin to test it.
Thank's again :-)
The easiest way is to just to click the "lost password" link in login.
If you are using active job, can you share this result?
RAILS_ENV=production bin/delayed_job status
decidim@decidim:~/decidim-app$ RAILS_ENV=production bin/delayed_job status delayed_job: running [pid 1304]
but still not sending emails.
Here latest ERROR log entries
----==_mimepart_5c654cdd667b2_4892ab2a2cbbaf4654c5--
connect_nonblock' /home/decidim/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/protocol.rb:44:in
ssl_socket_connect'
/home/decidim/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/smtp.rb:584:in `tlsconnect'----==_mimepart_5c654ce490ccb_4892ab2a2cbbaf4657f1--
E, [2019-02-14T12:11:32.620482 #1161] ERROR -- : [ActiveJob] [ActionMailer::DeliveryJob] [f86076ac-56b7-4d93-a99d-b913d14a87ce] Error performing ActionMailer::DeliveryJob (Job ID: f86076ac-56b7-4d93-a99d-b913d14a87ce) from Async(mailers) in 302.54ms: OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv3/TLS write client hello: wrong version number):
/home/decidim/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/protocol.rb:44:in connect_nonblock' /home/decidim/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/protocol.rb:44:in
ssl_socket_connect'
/home/decidim/.rbenv/versions/2.5.1/lib/ruby/2.5.0/net/smtp.rb:584:in `tlsconnect'
It seems that something is wrong with the SSL configuration, can you tell me if your this parts of your config/application.yml:
SMTP_ADDRESS: smtp.gmail.com
SMTP_DOMAIN: gmail.com
And config/secrets.yml:
production:
<<: *default
...
smtp_domain: <%= ENV["SMTP_DOMAIN"] %>
smtp_port: "587"
smtp_starttls_auto: true
smtp_authentication: "plain"
Matchs your configuration?
This is exactly my setup, I'v tryed with main gmail pwd and also with a secondary password. Thanks again.
From here: https://gist.github.com/mislav/5026283 Maybe you need root certificates installed?
apt-get install ca-certificates
apt-get install ca-certificates
Already installed...
I'm finally able to send messages, I'v fixed it following this: https://coderwall.com/p/ubl6iw/fix-ssl_connect-returned-1-errno-0-state-sslv3-read-server-certificate-b-certificate-verify-failed-openssl-ssl-sslerror Hope this helps someone :-)
thanks pol!
I can't send messages from Decidim: These are my last error logs
I have verified that you can access port 587. I have disabled IPv6, as suggested in the manual. It passed you part of the application.yml and secrets.yml configuration:
Are you sure that you can use office365 for this? I don't have experience with it
Been reading and looking for information and I think you can't. Also thank you very much for your help.
You should be able to do it with Office365 as well: https://docs.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-microsoft-365-or-office-365
If nothing else, the option 3 (relay) will work.
I would not suggest using something like this in production, though. It has some limitations.
Hi
I installed Decidim using the automated script recommended by Platoniq's documentation https://github.com/Platoniq/decidim-install ./install-decidim.sh -u some@email.com -p some-password my-decidim and i ran perfect with no error
I continued with basic configuration here https://github.com/Platoniq/decidim-install/blob/master/basic-config.md
I didn't set SSL up
I am using gmail as my SMTP provider.
I am confident that the issue is not a typo in my decidim.rb, and application.yml files.
I set up my gmail settings allow less secure apps.
Everything looks OK since the command grep ERROR ~/decidim-app/log/production.log -A3 -B3 gives following result : Fichier binaire /home/pretdegilles/decidim-app/log/production.log correspondant
Telnet smtp.gmail.com 587 answers "connected" nc -zv smtp.server.tld 587 answers "nc: getaddrinfo for host "smtp.server.tld" port 587: Name or service not known"
Could you tell me what's wrong with my config ?
Help appreciated since our village decided to use decidim in order to help for democraty
smtp.server.tld
? where do you get this from ?
Hi I found smtp.server.tld in the 8th post above.
Anyway, I re-installed Lubuntu on a i386 machine and decidim with the automated script, giving system admin same user and password as gmail's I have no mail server installed neither apache I didn't set SSL up, I am using gmail as my SMTP provider, I made several try with "an application specific password" and "less secure applications", I unlocked Captcha before I key enter on the organization page. The command grep ERROR ~/decidim-app/log/production.log -A3 -B3 returned ----==_mimepart_605c9d5ae8958_77e1fe6e43421--
E, [2021-03-25T15:25:33.735724 #1918 (External link)] ERROR -- : [ActiveJob] [ActionMailer::DeliveryJob] [2dbeae08-3fe3-444e-8b2f-468b2516130e] Error performing ActionMailer::DeliveryJob (Job ID: 2dbeae08-3fe3-444e-8b2f-468b2516130e) from Async(mailers) in 3772.25ms: Net::SMTPAuthenticationError (535-5.7.8 Username and Password not accepted.
I'm sure having writen gmail's user and password correctly in the organization page as well as in application.yml
Thank you for taking my question into account.
Hello
my decidim does not send starttls anymore, but in organization I have port 587 here the error E, [2021-05-13T06:27:04.023561 #817] ERROR -- : [ActiveJob] [ActionMailer::DeliveryJob] [feeeb8ab-ccd9-459f-be67-7a621b4ed71c] Error performing ActionMailer::DeliveryJob (Job ID: feeeb8ab-ccd9-459f-be67-7a621b4ed71c) from Async(mailers) in 510.03ms: Net::SMTPAuthenticationError (530 5.7.0 Must issue a STARTTLS command first ):
it is like enable_starttls_auto=>true is lost in database, b/c if I do it by console, it works fine:
Loading production environment (Rails 5.2.5) irb(main):001:0> irb(main):002:0> mailer = ActionMailer::Base.new irb(main):003:0> mailer.delivery_method => :smtp irb(main):004:0> mailer.smtp_settings => {:address=>"mail.possibile.com", :port=>"587", :authentication=>"plain", :user_name=>"...........", :password=>".........", :domain=>"possibile.com", :enable_starttls_auto=>true, :openssl_verify_mode=>"none"} irb(main):005:0> mailer.mail(from: 'decidiamo@possibile.com', to: 'decidiamo@possibile.com', subject: 'test', body: "Hello, you've got mail!").deliver Sent mail to decidiamo@possibile.com (997.8ms) Date: Thu, 13 May 2021 06:50:35 +0200 From: decidiamo@possibile.com To: decidiamo@possibile.com Message-ID: 609cb01b670_59da1b8286407b@partecipa.possibile.com.mail Subject: test Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit
Hello, you've got mail!
=> #<Mail::Message:390520, Multipart: false, Headers: <Date: Thu, 13 May 2021 06:50:35 +0200>, <From: decidiamo@possibile.com>, <To: decidiamo@possibile.com>, <Message-ID: 609cb01b670_59da1b8286407b@partecipa.possibile.com.mail>,
can you help me? 10x
Hi I found smtp.server.tld in the 8th post above. smtp.server.tld is a placeholder, something to be changed with what does fit your configuration If you are using gmail change it accordingly sed -i -e s/smtp.server.tld/smtp.gmail.com/g whatever.yml
I've followed the config doc https://github.com/Platoniq/decidim-install/blob/master/basic-config.md to config my own email server and it's not sending it, although decidim says it is. I have changed the port value in config/secrets.yml to the right one wiht no luck. How is decidim sending email? How can I check the logs?