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 @@
web: bundle exec rackup

+ 5
- 0
config.ru View File

@@ -0,0 +1,5 @@
$LOAD_PATH << '.'

require 'lib/contact.rb'

run Sinatra::Application

+ 8
- 4
lib/contact.rb View File

@@ -22,10 +22,7 @@ post '/messages' do
@email = params['email']
@message = params['message']

Pony.mail(to: Contact.config.mail_to,
from: Contact.config.mail_from,
reply_to: @email,
body: erb(:mail_text))
Pony.mail(reply_to: @email, body: erb(:mail_text))
status 201
end

@@ -62,3 +59,10 @@ module Contact
end

require_relative '../config/environment.rb'

Pony.options = {
to: Contact.config.mail_to,
from: Contact.config.mail_from,
via: :smtp,
via_options: Contact.config.smtp_options
}

Loading…
Cancel
Save