Во время отправки письма произошла ошибка execution expired

I’m having problems using email in redmine. This is my redmine Environment versions:

Environment:
  Redmine version                2.4.2.stable
  Ruby version                   1.9.3-p484 (2013-11-22) [x86_64-linux]
  Rails version                  3.2.16
  Environment                    production
  Database adapter               MySQL
SCM:
  Git                            1.9.1
  Filesystem                     
Redmine plugins:
  no plugin installed

I configured the configuration.yml file like this:

production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      enable_starttls_auto: true
      address: "smtp.office365.com"
      port: 587
      domain: "mydomain.com.br"
      authentication: :login
      user_name: "user@mydomain.com.br"
      password: "mypassword"

  attachments_storage_path: /home/redmin/Downloads/redmine-2.3.2/files

  autologin_cookie_name:
  autologin_cookie_path:
  autologin_cookie_secure:

  scm_subversion_command: svn
  scm_mercurial_command:
  scm_git_command: /usr/bin/git
  scm_cvs_command:
  scm_bazaar_command:
  scm_darcs_command:

  scm_stderr_log_file:

  database_cipher_key:

  rmagick_font_path:

So, i access redmine in browser and click in button «Send Test Email» but i got the following error: execution expired after a lot of time loading page.

In my production.log file i got a success message without any error, but e-mail never arrive:

Sent email "Redmine test" (30215ms)
  to: target@gmail.com

Edit 1:
If i change the devlivery_method to «:sendmail» the test works but email never arrives.

asked Feb 24, 2018 at 20:55

Ronaldo Lanhellas's user avatar

Load 7 more related questions

Show fewer related questions

im trying to send a email with action mailer and it gives me a Timeout::Error (execution expired): even though in the console it says that the e mail is sent:
it shows

    Sent mail to aldeirm2@gmail.com

then displayes the e mail that was sent then it shows the following error:

Timeout::Error (execution expired):
  /usr/lib/ruby/1.8/timeout.rb:60:in `open'
  /usr/lib/ruby/1.8/net/smtp.rb:551:in `do_start'
  /usr/lib/ruby/1.8/net/smtp.rb:551:in `do_start'
  /usr/lib/ruby/1.8/net/smtp.rb:525:in `start'
  app/models/appointment.rb:10:in `tomorrows_appointments'
  app/models/appointment.rb:8:in `each'
  app/models/appointment.rb:8:in `tomorrows_appointments'
  app/controllers/show_appointments_controller.rb:11:in `send_email'
  -e:2:in `load'
  -e:2

Rendered rescues/_trace (35.8ms)
Rendered rescues/_request_and_response (0.3ms)
Rendering rescues/layout (internal_server_error)

here is my settings:

config.cache_classes = false
config.whiny_nils = true
config.action_controller.consider_all_requests_local = true
config.action_view.debug_rjs                         = true
config.action_controller.perform_caching             = false

config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :enable_starttls_auto => true,
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :domian               => "gmail.com",
  :authentication       => :login,
  :user_name            => "username",
  :password             => "blablabla",
}

i also tried setting authentication to :plain and using username@gmail.com as the user_name with no hope.

any ideas

asked Aug 2, 2010 at 3:07

Mo.'s user avatar

I saw a typo there: you wrote
:domian => «gmail.com»,

instead of

:domain => «gmail.com»,

answered Jan 24, 2011 at 12:52

mir's user avatar

mirmir

3261 gold badge2 silver badges7 bronze badges

SMTP requests seem to time out occasionally, probably depending on how long you’ve set for timeouts. The other problem you’ll get is a delay in the web-app while the user waits for your server to communicate with Gmail’s SMTP server.

I know gmail is a popular option for new rails apps, but I don’t think it’s a long-term solution since you have to send the mail through a particular gmail account which has daily sending limits. And even with other accounts, I have found that SMTP timeouts are a problem.

Now I am using SendGrid to send emails and have found that using sendgrid as a relayhost via postfix is the favourable option. This means the user gets a response from the web-app faster and the mail is queued through postfix and then sent via sendgrid (so no more timeouts!).

See here for sendgrid’s postfix setup instructions:
http://wiki.sendgrid.com/doku.php?id=postfix

Then, in your rails environment, you just need something like the following:

config.action_mailer.delivery_method = :sendmail
config.action_mailer.sendmail_settings = {
  :location       => '/usr/sbin/sendmail',
  :arguments      => '-i -t'
}

answered Aug 2, 2010 at 8:58

ice cream's user avatar

ice creamice cream

2,4442 gold badges17 silver badges13 bronze badges

In case anyone else has the same problem:

make sure that your firewall allows outgoing connections to port 587

For iptables, you can list all existing rules with:

sudo iptables -L

have a look here for the necessary rules.

If you’re using an AWS instance, have a look at your security groups.

Community's user avatar

answered May 22, 2014 at 15:26

kitteehh's user avatar

kitteehhkitteehh

4427 silver badges10 bronze badges

Forums » Help »

Hi all,

I know this issue has been discussed a hundred times before, but still I am unable to make it work

  • ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
  • Rails 3.2.17
  • CentOS 6.5
  • mysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1
  • probably Webrick…

My entire configuration.yml file is as follows

production:
email_delivery:
delivery_method: :smtp
smtp_settings:
enable_starttls_auto: true
address: «smtp.gmail.com»
port: ‘587’
domain: «smtp.gmail.com»
authentication: :plain
user_name: «my_account@gmail.com»
password: «my_password»

I have copied it from the documentation, but I keep getting the following error
«An error occurred while sending mail (execution expired)»

Don’t know what to do now,

I would greatly appreciate any help or advice

Thank you in advance!

7 Replies

  • Author Michael - 622

    Well erhm. Do you have some more information of some sort ?

    That error there is just another word for Timed out afaik.

    Could be a wrong setup. could actually be anything, until some more info have been shown ;)


    Was this post helpful?
    thumb_up
    thumb_down

  • Author Devan

    further i checked up with my setup. still the error is persisting.

    Tell me some more suggestion to rectify this problem.


    Was this post helpful?
    thumb_up
    thumb_down

  • Author Michael - 622

    Well. assuming its the Spiceworks notification you are trying to setup (and you just want it to report the errors you’ve specified). You need a mail account for Spiceworks to use, and an useraccount /w password (not required, but a good idea to use password protected mail, just in case).

    I.e. something like this:

    Email address to send notifications from: IT_event@domain.com

    Display name: Spiceworks notification

    mailserver: mail.domain.com

    SMTP domain.com

    PORT: 25

    and then use the specified user account and password for that specific mail.

    Do you need to send mails to Spiceworks ? or is it the ticket system you want to use ?

    I hope its Spiceworks we’re talking about, or else this reply would seem pretty stupid :S


    Was this post helpful?
    thumb_up
    thumb_down

  • Author Marcio Merlone

    I am having exactly the same issue. I run Spiceworks on a Windows 2003 Server R2 and am trying to setup email support. On smtp server field I tried both hostname and IP address of our mail server (a linux box). I am pretty sure values are correct, I can ping the mail server both by hostname and IP address from the Spiceworks server. But still, I get «SMTP Error: execution expired» when click on «Save» button after a dozen of seconds.


    Was this post helpful?
    thumb_up
    thumb_down

  • Author Michael - 622

    On the server you say, are there any others besides you that uses Spiceworks then (if not, i’d recommend installing it on a client instead of the server, since it can get the system to hang just a bit when scanning. Havent tried it on a server myself though.)

    Besides that — If the earlier comments cant help you, perhaps you should try checking firewalls, useraccount(for the spicework app), and restrictions of this.

    If thats not cause of the problem, try to set it up on a client and see if you get the same issue there.


    Was this post helpful?
    thumb_up
    thumb_down

  • Author Marcio Merlone

    I sort of found what’s going on. I use McAfee Viruscan Enterprise and that is blocking smtp access to the mail server. Now, I have to find how to bypass that. Got some home work to do now. ;)


    Was this post helpful?
    thumb_up
    thumb_down

  • Author Subhash Subbu

    hi came these type of errors are came plz suggest me how to rectify

    Error on outgoing settings: Sending email from SMTP server failed: end of file reached Error on incoming settings: 


    Was this post helpful?
    thumb_up
    thumb_down

Я использую Gem Delayed Job для отправки электронных писем с помощью Amazon SES. Однако иногда он сталкивается с execution expired ошибка. Вероятно, некоторые проблемы с подключением к SES. Мне интересно, как я могу поймать это исключение и перепланировать электронную почту вручную? По внутренним причинам отложенное задание настроено на одну максимальную попытку

| execution expired
/usr/local/lib/ruby/2.0.0/net/smtp.rb:540:in `initialize'
/usr/local/lib/ruby/2.0.0/net/smtp.rb:540:in `open'
/usr/local/lib/ruby/2.0.0/net/smtp.rb:540:in `tcp_socket'
/usr/local/lib/ruby/2.0.0/net/smtp.rb:550:in `block in do_start'
/usr/local/lib/ruby/2.0.0/net/smtp.rb:549:in `do_start'
/usr/local/lib/ruby/2.0.0/net/smtp.rb:519:in `start'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/mail-2.5.4/lib/mail/network/delivery_methods/smtp.rb:112:in `deliver!'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/mail-2.5.4/lib/mail/message.rb:2129:in `do_delivery'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/mail-2.5.4/lib/mail/message.rb:232:in `block in deliver'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/actionmailer-4.0.0/lib/action_mailer/base.rb:456:in `block in deliver_mail'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `block in instrument'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/notifications.rb:159:in `instrument'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/actionmailer-4.0.0/lib/action_mailer/base.rb:454:in `deliver_mail'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/mail-2.5.4/lib/mail/message.rb:232:in `deliver'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/performable_mailer.rb:6:in `perform'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/backend/base.rb:105:in `block in invoke_job'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:60:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:60:in `block in initialize'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:65:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:65:in `execute'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/backend/base.rb:102:in `invoke_job'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:206:in `block (2 levels) in run'
/usr/local/lib/ruby/2.0.0/timeout.rb:66:in `timeout'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:206:in `block in run'
/usr/local/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:205:in `run'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:267:in `block in reserve_and_run_one_job'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:60:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:60:in `block in initialize'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:65:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:65:in `execute'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:267:in `reserve_and_run_one_job'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:189:in `block in work_off'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:188:in `times'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:188:in `work_off'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:153:in `block (4 levels) in start'
/usr/local/lib/ruby/2.0.0/benchmark.rb:296:in `realtime'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:152:in `block (3 levels) in start'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:60:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:60:in `block in initialize'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:65:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:65:in `execute'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:151:in `block (2 levels) in start'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:150:in `loop'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:150:in `block in start'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/plugins/clear_locks.rb:7:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in <class:ClearLocks>'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:78:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:78:in `block (2 levels) in add'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:60:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:60:in `block in initialize'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:78:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:78:in `block in add'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:65:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:65:in `execute'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/lifecycle.rb:38:in `run_callbacks'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/worker.rb:149:in `start'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/command.rb:104:in `run'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/command.rb:92:in `block in run_process'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/application.rb:255:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/application.rb:255:in `block in start_proc'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/daemonize.rb:82:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/daemonize.rb:82:in `call_as_daemon'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/application.rb:259:in `start_proc'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/application.rb:296:in `start'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/application_group.rb:159:in `block (2 levels) in start_all'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/application_group.rb:158:in `fork'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/application_group.rb:158:in `block in start_all'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/application_group.rb:157:in `each'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/application_group.rb:157:in `start_all'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/controller.rb:80:in `run'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons.rb:197:in `block in run_proc'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/cmdline.rb:109:in `call'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons/cmdline.rb:109:in `catch_exceptions'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/daemons-1.1.9/lib/daemons.rb:196:in `run_proc'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/command.rb:90:in `run_process'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/command.rb:83:in `block in daemonize'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/command.rb:81:in `times'
/home/ubuntu/www/tf/shared/bundle/ruby/2.0.0/gems/delayed_job-4.0.0/lib/delayed/command.rb:81:in `daemonize'
/home/ubuntu/www/tf/current/bin/delayed_job:5:in `<main>'

2014-01-05 10:40

1
ответ

Решение

delayed_job предоставляет некоторые крючки, вы можете использовать error подключить, чтобы перенести задачу.

def error(job, exception)
  # if exception is the one occurring right now for expired execution
  # reschedule the job
  # be careful to avoid infinite rescheduling
end

2014-01-05 12:25

Понравилась статья? Поделить с друзьями:
  • Во время проверки подлинности произошла ошибка outlook
  • Во время отправки заявления произошла ошибка
  • Во время открытия galaxy themes произошла ошибка
  • Во время обработки описания аккаунта произошла ошибка стим
  • Во время проверки были обнаружены ошибки индексирования url