Module: ValidateHTML::MailerObserver

Defined in:
lib/validate_html/mailer_observer.rb

Overview

Validate the HTML of outgoing mail Use standalone or as an ActionMailer interceptor, observer, or preview_interceptor

Class Method Summary collapse

Class Method Details

.perform(email) ⇒ Mail Also known as: delivering_email, delivered_email, previewing_email

Validate the HTML of outgoing mail Use standalone or as an ActionMailer interceptor, observer, or preview_interceptor

Parameters:

  • email (Mail)

Returns:

  • (Mail)

    unmodified from the passed in param

Raises:

See Also:



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/validate_html/mailer_observer.rb', line 16

def perform(email)
  html_part = email.html_part
  return email unless html_part

  ValidateHTML.validate_html(
    html_part.body.raw_source,
    content_type: html_part.content_type,
    name: "email #{email.subject}"
  )

  email
end