Skip to content
This repository

Close SMTP connections after we're done with them #31

Open
wants to merge 1 commit into from

1 participant

Matt Palmer
Matt Palmer

Otherwise a heavily erroring app can cause resource exhaustion.

Matt Palmer Close SMTP connections after we're done with them
Otherwise a heavily erroring app can exhaust resources.
c837cdd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Mar 06, 2011
Matt Palmer Close SMTP connections after we're done with them
Otherwise a heavily erroring app can exhaust resources.
c837cdd
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 4 additions and 4 deletions. Show diff stats Hide diff stats

  1. 8  lib/rack/contrib/mailexceptions.rb
8  lib/rack/contrib/mailexceptions.rb
@@ -78,10 +78,10 @@ def send_notification(exception, env)
78 78
         server.enable_starttls 
79 79
       end
80 80
 
81  
-      server.start smtp[:domain], smtp[:user_name], smtp[:password], smtp[:authentication]
82  
-
83  
-      mail.to.each do |recipient|
84  
-        server.send_message mail.to_s, mail.from, recipient
  81
+      server.start smtp[:domain], smtp[:user_name], smtp[:password], smtp[:authentication] do |smtp|
  82
+        mail.to.each do |recipient|
  83
+          smtp.send_message mail.to_s, mail.from, recipient
  84
+        end
85 85
       end
86 86
     end
87 87
 
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.