正如标题所示,我正在尝试使用Heroku和Rails 3的简单电子邮件.我使用这个Heroku指南:
http://devcenter.heroku.com/articles/smtp
这是我的代码:
class Invite < ActionMailer::Base def signup_notification(user) recipients "#{user.first_name} <#{user.email}>" from "Test" subject "Please activate your new account" sent_on Time.now body :var => 'testing' end end
我在app / views / invite / signup_notification.rhtml中有一个视图
更新:我看到.rhtml不适用于Rails 3,所以我只是尝试了.html.erb,但我有相同的错误.
Your account has been created. Username: Password: Visit this url to activate your account:
然后在Heroku控制台我做到了这一点:
user = User.new(:first_name => 'Me',:email => 'me@hotmail.com',:login => 'me',:password => '1234')
然后这个:
Invite.deliver_signup_notification(user)
如果得到这个错误:
Net::SMTPSyntaxError: 501 Syntax error /user/ruby1.8.7/lib/ruby/1.8/net/smtp.rb:930:in `check_response` /user/ruby1.8.7/lib/ruby/1.8/net/smtp.rb:899:in `getok` /user/ruby1.8.7/lib/ruby/1.8/net/smtp.rb:828:in `mailfrom` /user/ruby1.8.7/lib/ruby/1.8/net/smtp.rb:653:in `sendmail`
感谢任何想法
解决方法
你的无效尝试从’test@example.com’改为.