带有Rails 3和Heroku Net :: SMTPSyntaxError的电子邮件:501语法错误 [英] Email With Rails 3 and Heroku Net::SMTPSyntaxError: 501 Syntax error
问题描述
正如标题所述,我正在尝试获取一封与Heroku和Rails 3一起使用的简单电子邮件。我正在使用此Heroku指南: http://devcenter.heroku.com/articles/smtp
As the title says I'm trying to get a simple email working with Heroku and Rails 3. I'm using this Heroku guide: http://devcenter.heroku.com/articles/smtp
这是我的代码:
我生成了一个看起来像这样的邮件程序:
I generated a mailer that looks like this:
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
我在<$ c中有一个视图$ c> app / views / invite / signup_notification.rhtml
更新:我看到了 .rhtml
在Rails 3上不起作用,所以我只是尝试了 .html.erb
,但出现了相同的错误。
UPDATE: I see that .rhtml
doesn't work with Rails 3 so I just tried .html.erb
but I got the same error.
Your account has been created.
Username:
Password:
Visit this url to activate your account:
然后在Heroku控制台中执行以下操作:
Then in the Heroku console I did this:
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尝试。
Your from
is invalid. Try from 'test@example.com' instead.
这篇关于带有Rails 3和Heroku Net :: SMTPSyntaxError的电子邮件:501语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!