我无法从本地主机发送邮件。这是我的代码。 起初我是生成邮件用户邮箱。 enviroment.rb:Ruby On Rails.How send email?
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:adress => '[email protected]',
:port => 25,
:authentication => :login,
:user_name => 'johnoggy3010',
:password => 'secret'
}
邮寄/ user_mailer文件:
class UserMailer < ActionMailer::Base
def mail(user)
rexipients '[email protected]'
from '[email protected]'
subject = "Hi"
body :user => user
end
end
我的控制器:
UserMailer.deliver_mail(params[:name])
和模板user_mailer文件/ welcome_email.html.erb:
<h1>Welcome to example.com,<%= user %> </h1>
但s omthing是错误的,我不知道什么exacally ...
我当然也不知道。你能发布你在发送邮件时看到的内容吗(错误消息,格式不正确的电子邮件,其他内容)?顺便说一下,“rexipients”不是你拼写'recipients'的方式...... – PinnyM 2013-04-26 14:19:58
我没有看到任何错误.... – 2013-04-26 14:24:45
那么,你看到什么让你觉得有什么错误? – PinnyM 2013-04-26 14:25:48