Guest User

Untitled

a guest
Sep 4th, 2018
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. rails 3 email sending problem
  2. class UserMailer < ActionMailer::Base
  3. default :from => "user@gmail.com"
  4.  
  5. def send_to(user)
  6. @user = user
  7. subject='welcome !'
  8. mail(:to=>'y.lan@gmail.com', :subject=>subject, :content_type => "text/html")
  9. mail.deliver
  10. end
  11. end
  12.  
  13. def CarsController < BaseController
  14. ...
  15. def register_finish
  16. UserMailer.send_to(user)
  17. end
  18.  
  19. end
  20.  
  21. config.action_mailer.delivery_method = :smtp
  22.  
  23. config.action_mailer.smtp_settings = {
  24. :address => "smtp.googlemail.com",
  25. :port => 532,
  26. :arguments => '-i'
  27. :enable_starttls_auto => true
  28. }
  29.  
  30. config.action_mailer.perform_deliveries = true
  31. config.action_mailer.raise_delivery_errors = true
  32.  
  33. ActionMailer::Base.delivery_method = :smtp
  34. ActionMailer::Base.smtp_settings = { ...}
  35.  
  36. config.action_mailer.delivery_method = :smtp
  37. config.action_mailer.smtp_settings = {...}
  38.  
  39. ActionMailer::Base.smtp_settings = {
  40. :address => "smtp.gmail.com",
  41. :port => 587,
  42. :domain => "domain.pl",
  43. :user_name => "username",
  44. :password => "password",
  45. :authentication => "plain",
  46. :enable_starttls_auto => true
  47. }
  48.  
  49. ActionMailer::Base.delivery_method = :smtp
  50.  
  51. ActionMailer::Base.smtp_settings = {
  52. :enable_starttls_auto => true,
  53. :address => 'smtp.gmail.com',
  54. :port => 587,
  55. :domain => 'your_domain',
  56. :authentication => :plain,
  57. :user_name => 'your_gmail_username',
  58. :password => 'your_gmail_password'
  59. }
  60.  
  61. ActionMailer::Base.default_url_options[:host] = "localhost:3000"
Add Comment
Please, Sign In to add comment