<commit_before>module Mailkit
  module Strategies
    class Sendgrid
      include Mailkit::Strategy

      def initialize(request)
        params = request.params
        envelope = JSON.parse(params[:envelope])

        @message = Mail.new do
          from params[:from]
          to envelope['to'].first
          subject params[:subject]
          set_envelope envelope

          body params[:text]

          html_part do
            content_type 'text/html; charset=UTF-8'
            body params[:html]
          end if params[:html]
        end
      end
    end
  end
end<commit_msg>Set headers from sendgrid payload.<commit_after>module Mailkit
  module Strategies
    class Sendgrid
      include Mailkit::Strategy

      def initialize(request)
        params = request.params
        envelope = JSON.parse(params[:envelope])

        @message = Mail.new do
          header params[:headers]
          from params[:from]
          to envelope['to'].first
          subject params[:subject]
          set_envelope envelope

          body params[:text]

          html_part do
            content_type 'text/html; charset=UTF-8'
            body params[:html]
          end if params[:html]
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.0756234915526951, 'fraction_numerical': 0.0016090104585679806, 'mean_word_length': 1.8401826484018264, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5609622', 'n_tokens_mistral': 325, 'n_tokens_neox': 316, 'n_words': 89}