Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

email debugging

  • Loading branch information...
commit 424aece11b7e9d2b9af2068044b0013057fac8ae 1 parent 8e4daac
Brandon West authored

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

  1. 46  index.rb
46  index.rb
@@ -8,18 +8,34 @@
8 8
 require 'pony'
9 9
 
10 10
 config_file 'iodoctor.yml'
11  
-Pony.options = {
12  
-  :via => :smtp,
13  
-  :via_options => {
14  
-    :address => 'smtp.sendgrid.net',
15  
-    :port => '587',
16  
-    :domain => 'iodoctor.net',
17  
-    :user_name => ENV['SENDGRID_USERNAME'],
18  
-    :password => ENV['SENDGRID_PASSWORD'],
19  
-    :authentication => :plain,
20  
-    :enable_starttls_auto => true
  11
+
  12
+configure :development do
  13
+  Pony.options = {
  14
+    :via => :smtp,
  15
+    :via_options => {
  16
+      :address => 'localhost',
  17
+      :port => '2525',
  18
+      :domain => 'iodoctor.net'
  19
+    }
  20
+  }
  21
+end
  22
+
  23
+configure :production do
  24
+  Pony.options = {
  25
+    :via => :smtp,
  26
+    :via_options => {
  27
+      :address => 'smtp.sendgrid.net',
  28
+      :port => '587',
  29
+      :domain => 'iodoctor.net',
  30
+      :user_name => ENV['SENDGRID_USERNAME'],
  31
+      :password => ENV['SENDGRID_PASSWORD'],
  32
+      :authentication => :plain,
  33
+      :enable_starttls_auto => true
  34
+    }
21 35
   }
22  
-}
  36
+end
  37
+
  38
+
23 39
 
24 40
 helpers Sinatra::Partials
25 41
 
@@ -53,14 +69,14 @@
53 69
 end
54 70
 
55 71
 post '/email' do
56  
-  body = params[:json]
57  
-  puts body
  72
+  json = params[:json]
  73
+  body = "Thanks for using I/O Doctor. Your .json file is attached."
58 74
   
59 75
   Pony.mail(:to => params[:to_address],
60 76
             :from => "json@iodoctor.net",
61 77
             :subject => "I/O Doctor JSON Output",
62  
-            :html_body => body,
63  
-            :body => body)
  78
+            :body => body,
  79
+            :attachments => {"iodoctor.json" => json})
64 80
 end
65 81
 
66 82
 post '/file' do 

0 notes on commit 424aece

Please sign in to comment.
Something went wrong with that request. Please try again.