Rails ActionMailer TSL plugin - Sender email problem

I use ActionMailer with the action_mailer_optional_tls plugin to send mails via Gmail.

Here is my setup:

class InstantMailer < ActionMailer::Base

  layout "email"  

  def support(ticket)
    @recipients  = "support@domain.com"
    @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

Environment:

# 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 => "account@domain.com",
  :password => "***"
}

This works fine when I send mail from my server to a user.

However, when a user fills in a contact form, the from field is still account@domain.com, and not the user's email. What is wrong?

Answers


Gmail doesnt allow to relay mails with mailadresses other than the registered...


Need Your Help

Facebook app count top users

mysql facebook apprequests

I'm using facebook requests in my app. Lets say for example i have a table like this in my db:

How to implement fast updating table in windows forms?

c# multithreading winforms datagridview

I'm currently using DataGridView to show my data in tabular format. It has 5 columns.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.