【问题标题】:Devise, no E-Mails设计,没有电子邮件
【发布时间】:2023-03-24 19:07:02
【问题描述】:

我安装了设计。

我运行 rails server -e development 并在 config/environments 中设置这一行:

config.action_mailer.default_url_options = {:host => 'localhost:3000'}

设计说:

 message with a confirmation link has been sent to your email address. Please open the      link to activate your account.

但是我没有收到任何邮件。

你怎么看?

【问题讨论】:

  • 你在development.rb中设置了smtp配置吗?
  • 不知道怎么做?啊,我又添加了一行:config.mailer_sender = "myapp@mail.de" in devise.rb

标签: ruby-on-rails devise


【解决方案1】:

将这些行添加到您的 development.rb 文件中

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :domain               => 'baci.lindsaar.net',
  :user_name            => '<username>',
  :password             => '<password>',
  :authentication       => 'plain',
  :enable_starttls_auto => true  }

有关发送和设置电子邮件here的更多信息

【讨论】:

  • 非常感谢。是否可以在不注册root用户的情况下默认设置登录?
  • 您可以手动创建用户u=User.create(:email =&gt; "abc@xyz.com", :password =&gt; "123456", :password_confirmation =&gt; "123456")然后u.confirm!完成注册,无需点击链接
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-08-04
  • 1970-01-01
  • 2011-08-22
  • 2016-05-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多