我是新來的rails和使用rails-2.3.5和ruby-1.8.7。這裏是我的notifier.rb型號:Rails - 如何在不觸發Net :: SMTPFatalError的情況下使用完整的電子郵件地址?
# app/models/notifier.rb
class Notifier < ActionMailer::Base
default_url_options[:host] = "foo.com"
#This method sends an email with token to users who request a new password
def password_reset_instructions(user)
subject "Password Reset Instructions"
from "Support Team<[email protected]>"
recipients user.email
sent_on Time.now
body :edit_password_reset_url =>
edit_password_reset_url(user.perishable_token)
end
end
當我把這個方法我收到以下錯誤:
Net::SMTPFatalError in Password resetsController#create
555 5.5.2 Syntax error. 36sm970138yxh.13
我發現一篇文章,說的問題是紅寶石1.8.4中的錯誤並且修復方法是從:from字段中刪除尖括號。果然,如果我只是使用「[email protected]」而不是「支持團隊<[email protected]>」,一切正常。
但是,在rails-2.3.5 API或ActionMailer Basics導軌指南中沒有提及此問題,實際上它們的actionmailer安裝示例中都顯示「名稱<郵件地址>」。任何人都知道我在做什麼錯了?
對不起,我以爲我已經迴應,但我沒有看到它在這裏。謝謝 - 你的解決方案就像一個魅力! – 2010-04-27 14:09:51
看起來像他們在3月29日修補。 – iwasrobbed 2011-04-29 17:18:00