Ruby on rails 如何在RubyonRails中创建联系人表单?

Ruby on rails 如何在RubyonRails中创建联系人表单?,ruby-on-rails,ruby,Ruby On Rails,Ruby,我已经开始使用在我的应用程序中创建联系人使用页面,但是每次我按submit时,它都会显示它发送了一封电子邮件,但它没有。有人知道该怎么做吗 我已将我的联系人更改为这样 # Use this hook to configure contact mailer. ContactUs.setup do |config| # ==> Mailer Configuration # Configure the e-mail address which email notifications shou

我已经开始使用在我的应用程序中创建联系人使用页面,但是每次我按submit时,它都会显示它发送了一封电子邮件,但它没有。有人知道该怎么做吗

我已将我的联系人更改为这样

# Use this hook to configure contact mailer.
ContactUs.setup do |config|

# ==> Mailer Configuration

# Configure the e-mail address which email notifications should be sent from.  If emails must be sent from a verified email address you may set it here.
# Example:
# config.mailer_from = "contact@please-change-me.com"
config.mailer_from = "name@live.com"

# Configure the e-mail address which should receive the contact form email notifications.
config.mailer_to = "name@live.com"

# ==> Form Configuration

# Configure the form to ask for the users name.
config.require_name = true

# Configure the form to ask for a subject.
config.require_subject = true

# Configure the form gem to use.
# Example:
# config.form_gem = 'formtastic'
config.form_gem = 'simple_form_for'
# Configure the redirect URL after a successful submission
config.success_redirect = '/'

# Configure the parent action mailer
# Example:
# config.parent_mailer = "ActionMailer::Base"

end

您的服务器/开发环境是否安装了邮件服务器? 如果没有,您可以尝试使用外部SMTP服务器,如Gmail

将此代码放在
config/environments/development.rb
或config/environments/production.rb`中,并相应地调整值:

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  address:              'smtp.gmail.com',
  port:                 587,
  domain:               'example.com',
  user_name:            '<username>',
  password:             '<password>',
  authentication:       'plain',
  enable_starttls_auto: true  }
config.action\u mailer.delivery\u method=:smtp
config.action\u mailer.smtp\u设置={
地址:'smtp.gmail.com',
港口:587,
域:“example.com”,
用户名:“”,
密码:“”,
身份验证:“普通”,
启用\u starttls\u auto:true}

详细信息:

我在development.rb中使用了此代码,并相应地更改了值,但是我仍然无法让它发送电子邮件。