Sha256: 0bc4a42751f18706e6b0643e67d8bd458314316a91e510baa79df0da77806b23

Contents?: true

Size: 516 Bytes

Versions: 3

Compression:

Stored size: 516 Bytes

Contents

module Chaskiq
  class SesSenderJob < ActiveJob::Base

    queue_as :mailers

    #send to ses
    def perform(campaign, subscription)
      subscriber = subscription.subscriber

      return if subscriber.blank?

      mailer     = campaign.prepare_mail_to(subscription)
      response   = mailer.deliver

      message_id = response.message_id.gsub("@email.amazonses.com", "")

      campaign.metrics.create(
        trackable: subscription,
        action: "deliver",
        data: message_id)

    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chaskiq-0.0.6 app/jobs/chaskiq/ses_sender_job.rb
chaskiq-0.0.5 app/jobs/chaskiq/ses_sender_job.rb
chaskiq-0.0.4 app/jobs/chaskiq/ses_sender_job.rb