Browse Source

Allow running in dev, using local env

tags/v0.1.0^2
Bèr Kessels 1 year ago
parent
commit
e35ec4e62a
3 changed files with 14 additions and 4 deletions
  1. 1
    0
      Procfile
  2. 5
    0
      config.ru
  3. 8
    4
      lib/contact.rb

+ 1
- 0
Procfile View File

@@ -0,0 +1 @@
1
+web: bundle exec rackup

+ 5
- 0
config.ru View File

@@ -0,0 +1,5 @@
1
+$LOAD_PATH << '.'
2
+
3
+require 'lib/contact.rb'
4
+
5
+run Sinatra::Application

+ 8
- 4
lib/contact.rb View File

@@ -22,10 +22,7 @@ post '/messages' do
22 22
   @email   = params['email']
23 23
   @message = params['message']
24 24
 
25
-  Pony.mail(to: Contact.config.mail_to,
26
-            from: Contact.config.mail_from,
27
-            reply_to: @email,
28
-            body: erb(:mail_text))
25
+  Pony.mail(reply_to: @email, body: erb(:mail_text))
29 26
   status 201
30 27
 end
31 28
 
@@ -62,3 +59,10 @@ module Contact
62 59
 end
63 60
 
64 61
 require_relative '../config/environment.rb'
62
+
63
+Pony.options = {
64
+  to: Contact.config.mail_to,
65
+  from: Contact.config.mail_from,
66
+  via: :smtp,
67
+  via_options: Contact.config.smtp_options
68
+}

Loading…
Cancel
Save