Rails Sendmail and SPAM Filters

February 6, 2008

 
No Gravatar

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# 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

 
close Reblog this comment
blog comments powered by Disqus