1

I want to send an email from localhost via my gmail account in ruby on rails 6

config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_options = {from: 'no-reply@example.com'}
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
    
    
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  address:              'smtp.gmail.com',
  port:                 587,
  domain:               'example.com',
  user_name:            'mymail@gmail.com',
  password:             '<password>',
  authentication:       'plain',
  enable_starttls_auto: true }

Can anybody please help me? it is showing bad username /password SMTPAuthenticationError

Alexis
  • 4,836
  • 2
  • 21
  • 27
  • Change domain to gmail.com & check again https://stackoverflow.com/a/25872863/297087 – Salil Sep 11 '20 at 12:35
  • 1
    Not the cu8rrent issue, but know that you cannot set the `from` to be different from the `user_name` when you're sending from a gmail account. Try setting access to less secure https://hotter.io/docs/email-accounts/secure-app-gmail/ or (even better) set a password only for this app, see this answer https://stackoverflow.com/a/32690785/2516474 – SteveTurczyn Sep 11 '20 at 12:52

0 Answers0