class EmailProcessor
  def initialize(email)
    @email = email
  end

  def process
    newsletter = Newsletter.find_by_email(@email.to[0][:token])
    if !newsletter.nil?
      # @email.pry
      Email.create(
        newsletter_id: newsletter.id,
        to: @email.to[0][:email],
        from: @email.from[:email],
        subject: @email.subject,
        body: @email.body
      )
    end
  end
end

class EmailProcessor
  def initialize(email)
    @email = email
  end

  def process
    newsletter = Newsletter.find_by_email(@email.to[0][:token])
    if !newsletter.nil?
      # @email.pry
      Email.create(
        newsletter_id: newsletter.id,
        to: @email.to[0][:email],
        from: @email.from[:email],
        raw_text: @email.raw_text,
        raw_html: @email.raw_html,
        raw_body: @email.raw_body,
        body: @email.body
      )
    end
  end
end

Save the content from the email request
Save the content from the email request
