我想設置我的rails 4應用程序,所以它發送電子郵件。有誰知道爲什麼我收到:Net :: SMTPAuthenticationError
Net::SMTPAuthenticationError
534-5.7.9 Application-specific password required.
??????
我正在使用設計,並剛剛設置了一個單獨的「共享」郵件發送電子郵件。我嘗試按照其他對此類問題的回覆中的建議去accounts.google.com/b/0/DisplayUnlockCaptcha,但是當我重新啓動服務器並嘗試以用戶身份發送電子郵件時,沒有任何更改。
有什麼想法?乾杯!
配置/環境/ development.rb:
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
# Do not eager load code on boot.
config.eager_load = false
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
# Don't care if the mailer can't send.
# config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
# Gmail SMTP server setup
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:domain => "mail.google.com",
:port => 587,
:authentication => :plain,
:user_name => "[email protected]",
:password => "myrealpassword",
:enable_starttls_auto => true
}
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
# Debug mode disables concatenation and preprocessing of assets.
# This option may cause significant delays in view rendering with a large
# number of complex assets.
config.assets.debug = true
# Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies.
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
# false prevents mail from being sent in development environment
config.action_mailer.perform_deliveries = true
end
郵件/共享:
class Share < ActionMailer::Base
default_url_options[:host] = "localhost:3000"
default from: "[email protected]"
def profile(profile, destination)
@profile = profile
mail(to: destination, subject: "sent you stuff")
end
end
我認爲你的Gmail有問題,也許它被鎖定。嘗試在gmail上使用該帳戶登錄以查看發生了什麼。 – Thanh 2014-09-01 09:18:30
嗨!我可以很好地登錄。我嘗試解鎖captcha,以及哪些shoud允許訪問10分鐘的方式正確..仍然不知道爲什麼它不開心。 任何想法如何禁用發送,所以我可以擺脫瀏覽器錯誤? – sss333 2014-09-01 20:28:46
嘗試測試一個簡單的發送電子郵件功能,以確保它正常工作 – Thanh 2014-09-03 04:50:16