Rails SMTP setting without authentication
A typical smtp.rb initializer looks like this:
ActionMailer::Base.smtp_settings = { :address => 'smtp.domain.com', :port => 123, :domain => 'domain.com', :user_name => 'username', :password => 'password', :authentication => 'plain', :enable_starttls_auto => true }
If you are sending out email from an SMTP server that does not require authentication, a common mistake is to set empty string in user_name and password. This is incorrect because the action mailer will try to authenticate with empty username and password.
ActionMailer::Base.smtp_settings = { :address => 'smtp.domain.com', :port => 123, :domain => 'domain.com', :user_name => '', :password => '', :authentication => 'plain', :enable_starttls_auto => true }
You should just remove the user_name, password and authentication key from the setting:
ActionMailer::Base.smtp_settings = { :address => 'smtp.domain.com', :port => 123, :domain => 'domain.com', :enable_starttls_auto => true }
AI Summary
Chrome On-device AI
2024-10-04 22:57:47
Share Article