2013-09-24 48 views
0

我在使用郵件程序中的rails配置地址時遇到了麻煩。我使用最新的ruby和rails版本,並希望從配置中添加郵件地址。在development.rb頁面上使用郵件程序的導軌配置

mail(to: Rails.configuration.email.sales , subject: 'Contact through jobs page') 

我使用此代碼: 我使用的folling代碼的郵件文件

config.email.sales = '[email protected]' 

我不明白爲什麼這個心不是工作。 如果你能幫助我,那會很棒。由於

+0

你應該使用一個config yml文件。我喜歡意識到這一點的方式在我看來是不可能的。 – Mattherick

+0

您是否嘗試過使用普通郵件而不是Rails.configuration.email.sales – aelor

+0

當我使用類似 的郵件(如:'sales @ domain',主題:'通過作業頁面聯繫') 其工作良好 – Crag

回答

1

既然你添加到development.rb,你可以用類似嘗試:

mail(to: YourApplication::Application.config.email.sales,, subject: 'Contact through jobs page') 

,將返回「[email protected]」,如果你有正確config.email.sales工作:)。