-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhelpers.rb
51 lines (51 loc) · 1.98 KB
/
helpers.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
module Helpers
def self.included( app )
app.helpers do
def test(text)
puts "Testing: " + text + "..."
end
def send_validation_code(email, code, time, first)
pp "Sending validation code over email!!!!!!"
pp ENV['RACK_ENV']
message = "#{first},
Thank you for registering at ProfBingo.com.
Please click here to complete your registration: <http://profbingo.com/validate/#{email}/#{code}/#{time.to_i}/></a>"
message_html = "#{first},
Thank you for registering at ProfBingo.com.
Please click here to complete your registration: <a href=\"http://profbingo.com/validate/#{email}/#{code}/#{time.to_i}/\">Verify my email address!</a>"
if(ENV['RACK_ENV'] == 'production')
# Running on Heroku, use sendgrid
options = {
:address => 'smtp.sendgrid.net',
:port => '587',
:enable_starttls_auto => true,
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:authentication => :plain,
:domain => ENV['SENDGRID_DOMAIN']
}
else
# Running locally, use gmail
options = {
:address => 'smtp.gmail.com',
:port => '587',
:enable_starttls_auto => true,
:user_name => ENV['GMAIL_USERNAME'],
:password => ENV['GMAIL_PASSWORD'],
:authentication => :plain,
:domain => 'profbingo.com'
}
end
Pony.mail(
:from => "[email protected]",
:to => email,
:subject => "Your registeration of at ProfBingo.com",
:body => message,
:html_body => message_html,
:port => '587',
:via => :smtp,
:via_options => options)
end
end
end
end