2011-02-02 26 views
3

我有一個Ruby on Rails應用程序運行rails v2.3.5,它已經發送了很長一段時間的text/html郵件。最近我們注意到有些收件人收到的電子郵件是HTML代碼而不是HTML/ERB模板。儘管這並不是全面的,並且通常同一個電子郵件客戶端將同時接收HTML和HTML作爲文本,所以我不認爲它是客戶端電子郵件程序。爲什麼ActionMailer(rails 2.3.5)會間歇性地發送text/html郵件?

下面是一個擴展了ActionMailer :: Base的Notifier.rb的代碼片段。這一行動使customer_order_notification.text.html.erb

def customer_order_notification(order) 
    subject  "Thanks for your order!" 
    body   :order => order 
    recipients  RAILS_ENV == 'development' ? APP_CONFIG['dev_email'] : order.email 
    bcc   RAILS_ENV == 'production' ? APP_CONFIG['supervisor_email'] : nil 
    from   'MyWebsite <[email protected]>' 
    sent_on  Time.now 
    content_type = "text/html" 
    headers  = {} 
end #end method customer_order_notification 

服務器運行電子郵件軟件和配置的ActionMailer後綴低於:

ActionMailer::Base.delivery_method = :smtp 
ActionMailer::Base.smtp_settings = { 
    :address => '127.0.0.1', 
    :port => 25, 
    :domain => 'localhost' 
} 
+0

也許某些客戶端的郵件客戶端只設置爲文本? – 2011-02-02 13:49:55

回答

0

我有一個類似的問題而回,但它從2.3.5升級到2.3.8後發生的事情,但事實上,它是發送短信到一些客戶端敲響夠鍾,我想分享到:

https://github.com/mikel/tmail/issues/7

無論如何,很容易檢查收件人是否在收件人字段中獲得雙行分隔符以排除它。客戶是否遇到使用Outlook的問題?

相關問題