Thank you for your time and help.
I checked delayed_job.log in both cases: when it sends email and when it doesn’t send it.
When sending email, these three lines are added to the end of log file:
INFO … Job ActionMailer::MailDeliveryJob…from DelayedJob(mailers) with arguments: … (queue=mailers) RUNNING
INFO … Job ActionMailer::MailDeliveryJob… … from DelayedJob(mailers) with arguments: … … (id=85) (queue=mailers) COMPLETED after 1.1596
INFO – : 2022-12-05T12:11:47+0100: [Worker(delayed_job.1 host:98 pid:2956888)] 1 jobs processed at 0.8379 j/s, 0 failed
However, it does not add anything to the delayed_jobs.log whenever emails are failed to be sent.
I used "
Delayed::Job.last.last_error" to check the emails error in production e and this was the result:
"uninitialized constant ActionMailer::MailDeliveryJob\nDid you mean? ActionMailer::DeliveryJob\n/home/deploy/consul/shared/bundle/ruby/2.7.0/gems/activesupport-22.214.171.124/lib/active_support/inflector/methods.rb:285:in
const_get'\n/home/deploy/consul/shared/bundle/ruby/2.7.0/gems/activesupport-126.96.36.199/lib/active_support/inflector/methods.rb:285:inblock in constantize’ \n/home/deploy/consul/shared/bundle/ruby/2.7.0/gems/activesupport-188.8.131.52/lib/active_support/inflector/methods.rb:281:in `each’\n/home/deploy/consul/shared/bundle/ruby/2.7.0/gems/activesupport-184.108.40.206/lib/active_support/inflector/methods.rb:281:in…
But I could also see this error before correctly configuring the smtp and be able to send my first email.