5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/litmus_mailer/mail_observer.rb', line 5
def delivered_email(mail)
Litmus::Base.new( Config.subdomain, Config.username, Config.password, Config.ssl )
if existing_test = Litmus::Test.find_by_name(mail.litmus_test)
Litmus::EmailTest.destroy(existing_test['id'])
Rails.logger.debug "Deleting Litmus test #{existing_test['id']} (#{existing_test['name']})"
end
body = (mail.parts.nil? || mail.parts.empty?) ? mail.body : mail.parts.last.body
new_test = Litmus::EmailTest.create({
:subject => mail.subject,
:body => body }, mail.litmus_test)
Rails.logger.debug "Created new Litmus test #{new_test['id']} (#{new_test['name']})"
new_test
end
|