Posts Tagged: spam


6
Feb 08

Rails Sendmail and SPAM Filters

One of the sites we’re working on sends an email upon the completion of a registration form. We were having problems with different SPAM filters catching and misflagging our emails. After doing a little research, it looks like we were omitting some important fields. Take a look at the before and after implementation.

# before
# note the lack of headers, sent on, and content type declarations
class Postoffice < ActionMailer::Base

  def welcome(email)
    @recipients = email
    @from = "Meeta Support <happy2help@meeta.com>"
    @subject = "Welcome to Meeta.com"
    body[:email] = email
  end

  def contact(params)
  end
 
end


# after
class Postoffice < ActionMailer::Base

protected

  def welcome(email)
    @recipients = email
    @from         = "Meeta Support <happy2help@meeta.com>"
    headers         "Reply-to" => "happy2help@meeta.com"
    @subject      = "Welcome to Meeta.com"
    @sent_on      = Time.now
    @content_type = "text/html"
    body[:email]  = email
  end
 
end