-
-
Save desbest/cc6b728e6c9832f8cf83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def feedback | |
if request.post? #this line is potentially dangerous! | |
data = request.subset(:message, :email, :email2, :technical) #data = request.xxx | |
#return data | |
@email = data.fetch("email"); @email2 = data.fetch("email2"); @message = data.fetch("message"); @technical = data.fetch("technical"); @username = user.username; if !@username then @username = "anonymous" end | |
@emailcontent = "Compesh feedback from <span style='font-weight: bold; color: #0066cc; font-size: 1.15em;'>#{@username}</span><br><br> <b>email: </b>#{@email}<br> <b>email2: </b>#{@email2}<br> <b>message: </b>#{@message}<br> <b>technical: </b>#{@technical}\n" | |
begin | |
Pony.mail(:html_body => @emailcontent, :reply_to => @email, :subject => "Compesh Feedback from #{@username}", :headers => { "X-MC-Tags" => "feedback" } ) | |
flash[:success] = 'Your email has been sent!' | |
redirect 'feedback' | |
rescue => e | |
logger = Ramaze::Logger::RotatingInformer.new('./log') | |
logger.error "Error emailing feedback. #{e}" #Ramaze::Log.error(e) | |
flash[:error] = 'Failure sending email. Contact technical support!' | |
redirect 'feedback' #redirect_referrer | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment