Aggiunge il rilevamento di invio e apertura delle email di campagna.
CI / scan_ruby (push) Failing after 12m56s
CI / scan_js (push) Successful in 12m23s
CI / lint (push) Failing after 12m15s

Ogni destinatario mostra se la mail è partita e se è stata aperta, con conteggi in dashboard.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-20 12:26:14 +02:00
co-authored by Cursor
parent ab57309f5c
commit 2db7504629
18 changed files with 332 additions and 5 deletions
+24
View File
@@ -0,0 +1,24 @@
require "base64"
class MailOpensController < ActionController::Base
PIXEL = Base64.decode64("R0lGODlhAQABAPAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==").freeze
def show
record_open
expires_now
response.set_header("Cache-Control", "no-store, no-cache, must-revalidate, private, max-age=0")
response.set_header("Pragma", "no-cache")
send_data PIXEL, type: "image/gif", disposition: "inline", filename: "o.gif"
end
private
def record_open
token = params[:token].to_s
recipient = MailingRecipient.find_by(tracking_token: token)
recipient&.record_open!
rescue StandardError => e
Rails.logger.warn("[mail_open] #{e.class}: #{e.message}")
raise if Rails.env.test?
end
end