我已经开始使用https://github.com/JDutil/contact_us在我的应用程序中创建联系人使用页面,但是每次按下提交时都说它发送了一封电子邮件,但它没有。有人知道该怎么做吗?
我已将contact_us.rb更改为
# 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
答案 0 :(得分:0)
您的服务器/开发环境是否安装了邮件服务器? 如果没有,您可以尝试使用外部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 }