Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2017
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.34 KB | None | 0 0
  1. post '/contact-us' do
  2. require 'pony'
  3. first_name = params[:first_name]
  4. last_name = params[:last_name]
  5. mail = params[:mail]
  6. subject = params[:subject]
  7. body = params[:body]
  8.  
  9. Pony.options = {
  10. :via => :smtp,
  11. :via_options => {
  12. :address => 'smtp.zoho.com',
  13. :location => '/c/sendmail/./sendmail',
  14. :ssl => true,
  15. :arguments => '-t',
  16. :port => '465',
  17. # :enable_starttls_auto => true,
  18. :user_name => 'username',
  19. :password => "password",
  20. :authentication => :login, # :plain, :login, :cram_md5, no auth by default
  21. :domain => "localhost",
  22. # :tls => true
  23. }
  24. }
  25.  
  26.  
  27. Pony.mail(
  28. :to => 'sales@nlm-marketing.com',
  29. :from => first_name + '<' + mail + '>',
  30. :reply_to => mail,
  31. :subject => subject,
  32. :body => body)
  33.  
  34.  
  35.  
  36. redirect '/success'
  37. end
  38.  
  39. c:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/smtp.rb in check_auth_response
  40. raise SMTPAuthenticationError, res.message
  41. c:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/smtp.rb in auth_plain
  42. check_auth_response res
  43. c:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/smtp.rb in authenticate
  44. send auth_method(authtype), user, secret
  45. c:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/smtp.rb in do_start
  46. authenticate user, secret, (authtype || DEFAULT_AUTH_TYPE) if user
  47. c:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/smtp.rb in start
  48. do_start helo, user, secret, authtype
  49. main.rb in block in <main>
  50. Pony.mail(
  51. c:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb in service
  52. si.service(req, res)
  53. c:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb in run
  54. server.service(req, res)
  55. c:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/webrick/server.rb in block in start_thread
  56. block ? block.call(sock) : run(sock)
  57. GET
  58. No GET data.
  59. POST
  60. Variable Value
  61. body
  62. "Testing"
  63. first_name
  64. "Michael"
  65. last_name
  66. "Stokes"
  67. mail
  68. "mjstokes1986@att.net"
  69. subject
  70. "Test"
  71. COOKIES
  72. No cookie data.
  73. Rack ENV
  74. Variable Value
  75. CONTENT_LENGTH
  76. 89
  77. CONTENT_TYPE
  78. application/x-www-form-urlencoded
  79. GATEWAY_INTERFACE
  80. CGI/1.1
  81. HTTP_ACCEPT
  82. text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
  83. HTTP_ACCEPT_ENCODING
  84. gzip, deflate
  85. HTTP_ACCEPT_LANGUAGE
  86. en-US,en;q=0.8
  87. HTTP_CACHE_CONTROL
  88. max-age=0
  89. HTTP_CONNECTION
  90. keep-alive
  91. HTTP_HOST
  92. localhost:4567
  93. HTTP_ORIGIN
  94. http://localhost:4567
  95. HTTP_REFERER
  96. http://localhost:4567/contact-us
  97. HTTP_UPGRADE_INSECURE_REQUESTS
  98. 1
  99. HTTP_USER_AGENT
  100. Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36
  101. HTTP_VERSION
  102. HTTP/1.1
  103. PATH_INFO
  104. /contact-us
  105. QUERY_STRING
  106. REMOTE_ADDR
  107. ::1
  108. REMOTE_HOST
  109. MSTOKES
  110. REQUEST_METHOD
  111. POST
  112. REQUEST_PATH
  113. /contact-us
  114. REQUEST_URI
  115. http://localhost:4567/contact-us
  116. SCRIPT_NAME
  117. SERVER_NAME
  118. localhost
  119. SERVER_PORT
  120. 4567
  121. SERVER_PROTOCOL
  122. HTTP/1.1
  123. SERVER_SOFTWARE
  124. WEBrick/1.3.1 (Ruby/2.1.5/2014-11-13)
  125. rack.errors
  126. #<Object:0x3471090>
  127. rack.hijack
  128. #<Proc:0x5dab6a8@c:/RailsInstaller/Ruby2.1.0/lib/ruby/gems/2.1.0/gems/rack-1.6.4/lib/rack/handler/webrick.rb:76 (lambda)>
  129. rack.hijack?
  130. true
  131. rack.hijack_io
  132. nil
  133. rack.input
  134. #<StringIO:0x5dab768>
  135. rack.logger
  136. #<Logger:0x5dd4e08 @progname=nil, @level=1, @default_formatter=#<Logger::Formatter:0x5dd4df0 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x5dd4dc0 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<IO:<STDERR>>, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x5dd4da8 @mon_owner=nil, @mon_count=0, @mon_mutex=#<Mutex:0x5dd4d78>>>>
  137. rack.multiprocess
  138. false
  139. rack.multithread
  140. true
  141. rack.request.cookie_hash
  142. {}
  143. rack.request.form_hash
  144. {"first_name"=>"Michael", "last_name"=>"Stokes", "mail"=>"mjstokes1986@att.net", "subject"=>"Test", "body"=>"Testing"}
  145. rack.request.form_input
  146. #<StringIO:0x5dab768>
  147. rack.request.form_vars
  148. first_name=Michael&last_name=Stokes&mail=mjstokes1986%40att.net&subject=Test&body=Testing
  149. rack.request.query_hash
  150. {}
  151. rack.request.query_string
  152. rack.run_once
  153. false
  154. rack.url_scheme
  155. http
  156. rack.version
  157. [1, 3]
  158. sinatra.accept
  159. [#<Sinatra::Request::AcceptEntry:0x63e7618 @entry="text/html", @type="text/html", @params={}, @q=1.0>, #<Sinatra::Request::AcceptEntry:0x63e74f8 @entry="application/xhtml+xml", @type="application/xhtml+xml", @params={}, @q=1.0>, #<Sinatra::Request::AcceptEntry:0x63e71f8 @entry="image/webp", @type="image/webp", @params={}, @q=1.0>, #<Sinatra::Request::AcceptEntry:0x63e7408 @entry="application/xml;q=0.9", @type="application/xml", @params={}, @q=0.9>, #<Sinatra::Request::AcceptEntry:0x63e7108 @entry="*/*;q=0.8", @type="*/*", @params={}, @q=0.8>]
  160. sinatra.commonlogger
  161. true
  162. sinatra.error
  163. #<Net::SMTPAuthenticationError: 535 Authentication Failed >
  164. sinatra.route
  165. POST /contact-us
  166.  
  167. Pony.mail({
  168. :to => 'you@example.com',
  169. :from => first_name + '<' + mail + '>',
  170. :reply_to => mail,
  171. :subject => subject,
  172. :body => body,
  173. :via => :smtp,
  174. :via_options => {
  175. :address => 'smtp.zoho.com',
  176. :port => 465,
  177. :user_name => 'user@email.com',
  178. :password => 'a password',
  179. :authentication => :login,
  180. :ssl => true,
  181. :tls => true,
  182. :enable_starttls_auto => true
  183. }
  184. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement