Another try to fix the mail

This commit is contained in:
Yann Esposito (Yogsototh) 2011-05-12 22:55:37 +02:00
parent 1430de432e
commit 8e994fd881

View file

@ -17,21 +17,22 @@ class MyMain < Rack::TryStatic
def call(env) def call(env)
request = Rack::Request.new(env) request = Rack::Request.new(env)
if request.path == "/contact" and request.post? if request.path == "/contact" and request.post?
Pony.mail( :to => "yann.esposito@gmail.com", Pony.mail(
:from => request[:mail], :from => request[:name] + '<' + request[:mail] +'>',
:subject => 'YPassword support', :to => "yann.esposito@gmail.com",
:body => request[:body], :subject => 'YPassword support',
:port => '587', :body => request[:body],
:via => 'smtp', :port => '587',
:via_options => { :via => :smtp,
:address => 'smtp.sendgrid.net', :via_options => {
:port => '587', :address => 'smtp.sendgrid.net',
:enable_starttls_auto => true, :port => '587',
:user_name => ENV['SENDGRID_USERNAME'], :enable_starttls_auto => true,
:password => ENV['SENDGRID_PASSWORD'], :user_name => ENV['SENDGRID_USERNAME'],
:authentification => :plain, :password => ENV['SENDGRID_PASSWORD'],
:domain => ENV['SENDGRID_DOMAIN'], :authentification => :plain,
}) :domain => ENV['SENDGRID_DOMAIN'],
})
return [200, { return [200, {
"Last-Modified" => File.mtime($mailFile).httpdate, "Last-Modified" => File.mtime($mailFile).httpdate,
"Content-Type" => "text/html", "Content-Type" => "text/html",