2010-10-30 43 views
2

我使用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],而不是用户的电子邮件。哪里不对?

回答

3

Gmail的犯规让与除注册的其他mailadresses中继邮件...

+1

哇,吸:( – Frexuz 2010-10-31 13:41:13

1

我改变交付方法:sendmail和它开始为我工作:-)

 

ActionMailer::Base.delivery_method = :sendmail 
 
相关问题