-
Notifications
You must be signed in to change notification settings - Fork 0
/
contact-send.rb
64 lines (56 loc) · 1.65 KB
/
contact-send.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#require 'sinatra'
#get '/index' do
# index.html
#end
#post '/#contact' do
# raise params[:name].inspect
# require 'pony'
# Pony.mail(
# :from => params[:name] + "<" + params[:email] + ">",
# :to => '[email protected]',
# :subject => params[:name] + " has contacted you",
# :body => params[:message],
# :port => '587',
# :via => :smtp,
# :via_options => {
# :address => 'smtp.gmail.com',
# :port => '587',
# :enable_starttls_auto => true,
# :user_name => 'manish.gauranga',
# :password => 'hare$krishna711889',
# :authentication => :plain,
# :domain => 'localhost.localdomain'
# })
#end
require 'sinatra'
require './rackmiddleware'
use RackMiddleware
get '/' do
redirect '/index'
end
get '/robots.txt' do
File.read(File.join('robots.txt'))
end
get '/index' do
erb :index
end
post '/ruby/contact-send.rb' do
#raise params[:name].inspect
require 'pony'
Pony.mail(
:from => params[:name] + "<" + params[:email] + ">",
:to => '[email protected]',
:subject => params[:name] + " has contacted you",
:body => params[:message]+" "+params[:email],
:port => '587',
:via => :smtp,
:via_options => {
:address => 'smtp.gmail.com',
:port => '587',
:enable_starttls_auto => true,
:user_name => 'manish.gauranga',
:password => 'hare$krishna711889',
:authentication => :plain,
:domain => 'localhost.localdomain'
})
end