Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
783
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.36 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
  5. </head>
  6. <body>
  7. <h1>Hi <%= @user.name %></h1>
  8. <p>
  9. Sample mail sent using smtp.
  10. </p>
  11. </body>
  12. </html>
  13.  
  14. class ExampleMailerPreview < ActionMailer::Preview
  15. def sample_mail_preview
  16. ExampleMailer.sample_email(User.first)
  17. end
  18. end
  19.  
  20. config.action_mailer.delivery_method = :smtp
  21. # SMTP settings for gmail
  22. config.action_mailer.smtp_settings = {
  23. :address => "smtp.gmail.com",
  24. :port => 587,
  25. :user_name => ENV['gmail_username'],
  26. :password => ENV['gmail_password'],
  27. :authentication => "plain",
  28. :enable_starttls_auto => true
  29. }
  30.  
  31. def create
  32. @user = User.new(user_params)
  33.  
  34. respond_to do |format|
  35. if @user.save
  36.  
  37. # Sends email to user when user is created.
  38. ExampleMailer.sample_email(@user).deliver
  39.  
  40. format.html { redirect_to @user, notice: 'User was successfully created.' }
  41. format.json { render :show, status: :created, location: @user }
  42. else
  43. format.html { render :new }
  44. format.json { render json: @user.errors, status: :unprocessable_entity }
  45. end
  46. end
  47. end
  48.  
  49. Started GET "/users/1/edit" for 127.0.0.1 at 2017-07-26 06:39:40 -0400
  50. Processing by UsersController#edit as HTML
  51. Parameters: {"id"=>"1"}
  52. User Load (1.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
  53. Rendering users/edit.html.erb within layouts/application
  54. Rendered users/_form.html.erb (6.0ms)
  55. Rendered users/edit.html.erb within layouts/application (103.3ms)
  56. Completed 200 OK in 419ms (Views: 355.3ms | ActiveRecord: 1.0ms)
  57.  
  58.  
  59. Started PATCH "/users/1" for 127.0.0.1 at 2017-07-26 06:39:45 -0400
  60. Processing by UsersController#update as HTML
  61. Parameters: {"utf8"=>"V", "authenticity_token"=>"7wdXKYpv+o+tNlmBBSdgIcOa0d07f6fUlFnJqZC1zbVyfLrhct57mLZQBd0EOP9Ckmsw9LoAlSfeMt2wjg1eLw==", "user"=>{"name"=>"rafael Guillermo R", "email"=>"rrg1459@hotmail.com"}, "commit"=>"Update User", "id"=>"1"}
  62. User Load (1.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
  63. (0.0ms) begin transaction
  64. SQL (2.0ms) UPDATE "users" SET "name" = ?, "updated_at" = ? WHERE "users"."id" = ? [["name", "rafael Guillermo R"], ["updated_at", "2017-07-26 10:39:45.599798"], ["id", 1]]
  65. (137.4ms) commit transaction
  66. Rendering example_mailer/sample_email.html.erb within layouts/mailer
  67. Rendered example_mailer/sample_email.html.erb within layouts/mailer (0.0ms)
  68. Rendering example_mailer/sample_email.text.erb within layouts/mailer
  69. Rendered example_mailer/sample_email.text.erb within layouts/mailer (1.0ms)
  70. ExampleMailer#sample_email: processed outbound mail in 364.2ms
  71. Sent mail to rrg1459@hotmail.com (2021.4ms)
  72. Date: Wed, 26 Jul 2017 06:39:46 -0400
  73. From: haierhke@gmail.com
  74. To: rrg1459@hotmail.com
  75. Message-ID: <597871721c2f3_1d342c744047949e@A001044638.mail>
  76. Subject: Sample Email
  77. Mime-Version: 1.0
  78. Content-Type: multipart/alternative;
  79. boundary="--==_mimepart_597871721a39a_1d342c7440479395";
  80. charset=UTF-8
  81. Content-Transfer-Encoding: 7bit
  82.  
  83.  
  84. ----==_mimepart_597871721a39a_1d342c7440479395
  85. Content-Type: text/plain;
  86. charset=UTF-8
  87. Content-Transfer-Encoding: 7bit
  88.  
  89. Hi rafael Guillermo R
  90. Sample mail sent using smtp.
  91.  
  92. ----==_mimepart_597871721a39a_1d342c7440479395
  93. Content-Type: text/html;
  94. charset=UTF-8
  95. Content-Transfer-Encoding: 7bit
  96.  
  97. <!DOCTYPE html>
  98. <html>
  99. <head>
  100. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  101. <style>
  102. /* Email styles need to be inline */
  103. </style>
  104. </head>
  105.  
  106. <body>
  107. <!DOCTYPE html>
  108. <html>
  109. <head>
  110. <meta content='text/html; charset=UTF-8' http-equiv='Content-Type' />
  111. </head>
  112. <body>
  113. <h1>Hi rafael Guillermo R</h1>
  114. <p>
  115. Sample mail sent using smtp.
  116. </p>
  117. </body>
  118. </html>
  119. </body>
  120. </html>
  121.  
  122. ----==_mimepart_597871721a39a_1d342c7440479395--
  123.  
  124. Redirected to http://localhost:3000/users/1
  125. Completed 302 Found in 2552ms (ActiveRecord: 140.4ms)
  126.  
  127.  
  128. Started GET "/users/1" for 127.0.0.1 at 2017-07-26 06:39:48 -0400
  129. Processing by UsersController#show as HTML
  130. Parameters: {"id"=>"1"}
  131. User Load (1.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT ? [["id", 1], ["LIMIT", 1]]
  132. Rendering users/show.html.erb within layouts/application
  133. Rendered users/show.html.erb within layouts/application (3.0ms)
  134. Completed 200 OK in 345ms (Views: 299.2ms | ActiveRecord: 1.0ms)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement