3

My ActionMailer is set up to send an email once a user fills out an application. After upgrading to Rails 3 and ActionMailer, gmail now seems to be classifying the response email as spam.

I use google apps for the domain (hosted by dreamhost) and have it set up to send as smtp; and I am able to directly send emails to the same users from the google apps web account, and not have it classified as spam.

My question is: are there settings or values that I should have set in the ActionMailer (etc) that might circumvent this?

One recommendation I got was to set up and SPF, but I wasn't sure about this as I was using smtp via gmail.

Here is my configuration:

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :user_name            => "email@domain.org",
  :password             => "password",
  :authentication       => "plain",
  :enable_starttls_auto => true
}

The email is rendered as html (have a plain text one too), with attachments of the files the user uploaded to the application.

<!DOCTYPE html>
<HTML>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
  </head>
  <body>
<p>
Dear <%= @f.first_name + " " + @f.last_name  %>,<br>
<br>
etc....

Here is how my mailer is formatted

class EmploymentMailer < ActionMailer::Base
  default :from => "email@domain.org"


  def employment_app_email(f, files)
    @f = f
    @files = files
    mail(:to => ['email@domain.org', f.email], :subject => "Subject")

    files.each do |file|
      attachments[file[1].original_filename] = File.open(file[1].path, 'rb'){|a| a.read}
    end
  end


end

0 Answers0