我使用ActionMailer和action_mailer_optional_tls插件通過Gmail發送郵件。Rails ActionMailer TSL插件 - 發件人電子郵件問題
這裏是我的設置:
class InstantMailer < ActionMailer::Base
layout "email"
def support(ticket)
@recipients = "[email protected]"
@from = ticket.email #this is the user's email
@subject = "[#{ticket.category}] #{ticket.subject}"
@sent_on = Time.now
@body[:ticket] = ticket
content_type "text/html"
end
end
環境:
# Mailer Settings
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:tls => true,
:address => "smtp.gmail.com",
:port => "587",
:domain => "domain.com",
:authentication => :plain,
:user_name => "[email protected]",
:password => "***"
}
這當我從我的服務器將郵件發送到用戶正常工作。
但是,當用戶填寫聯繫表時,從字段仍然是[email protected],而不是用戶的電子郵件。哪裏不對?
哇,吸:( – Frexuz 2010-10-31 13:41:13