chore: remove mailjet support
This commit is contained in:
parent
7143c7e8e2
commit
f9e7d5536b
10 changed files with 3 additions and 81 deletions
1
Gemfile
1
Gemfile
|
@ -57,7 +57,6 @@ gem 'kredis'
|
|||
gem 'listen' # Required by ActiveSupport::EventedFileUpdateChecker
|
||||
gem 'lograge'
|
||||
gem 'logstash-event'
|
||||
gem 'mailjet', require: false
|
||||
gem 'maintenance_tasks'
|
||||
gem 'matrix' # needed by prawn and not default in ruby 3.1
|
||||
gem 'mini_magick'
|
||||
|
|
17
Gemfile.lock
17
Gemfile.lock
|
@ -210,7 +210,6 @@ GEM
|
|||
diff-lcs (1.5.1)
|
||||
discard (1.3.0)
|
||||
activerecord (>= 4.2, < 8)
|
||||
domain_name (0.6.20240107)
|
||||
dotenv (2.8.1)
|
||||
dotenv-rails (2.8.1)
|
||||
dotenv (= 2.8.1)
|
||||
|
@ -305,9 +304,6 @@ GEM
|
|||
hashie (5.0.0)
|
||||
highline (3.0.1)
|
||||
htmlentities (4.3.4)
|
||||
http-accept (1.7.0)
|
||||
http-cookie (1.0.5)
|
||||
domain_name (~> 0.5)
|
||||
http_accept_language (2.1.1)
|
||||
httpclient (2.8.3)
|
||||
i18n (1.14.1)
|
||||
|
@ -395,11 +391,6 @@ GEM
|
|||
net-imap
|
||||
net-pop
|
||||
net-smtp
|
||||
mailjet (1.7.8)
|
||||
activesupport (>= 5.0.0)
|
||||
rack (>= 1.4.0)
|
||||
rest-client (>= 2.1.0)
|
||||
yajl-ruby
|
||||
maintenance_tasks (2.6.0)
|
||||
actionpack (>= 6.0)
|
||||
activejob (>= 6.0)
|
||||
|
@ -433,7 +424,6 @@ GEM
|
|||
timeout
|
||||
net-smtp (0.4.0.1)
|
||||
net-protocol
|
||||
netrc (0.11.0)
|
||||
nio4r (2.7.0)
|
||||
nokogiri (1.16.2)
|
||||
mini_portile2 (~> 2.8.2)
|
||||
|
@ -566,11 +556,6 @@ GEM
|
|||
responders (3.1.1)
|
||||
actionpack (>= 5.2)
|
||||
railties (>= 5.2)
|
||||
rest-client (2.1.0)
|
||||
http-accept (>= 1.7.0, < 2.0)
|
||||
http-cookie (>= 1.0.2, < 2.0)
|
||||
mime-types (>= 1.16, < 4.0)
|
||||
netrc (~> 0.8)
|
||||
rexml (3.2.6)
|
||||
rodf (1.2.0)
|
||||
builder (>= 3.0)
|
||||
|
@ -798,7 +783,6 @@ GEM
|
|||
nokogiri (~> 1.11)
|
||||
xpath (3.2.0)
|
||||
nokogiri (~> 1.8)
|
||||
yajl-ruby (1.4.3)
|
||||
zeitwerk (2.6.13)
|
||||
zip_tricks (5.6.0)
|
||||
zipline (1.5.0)
|
||||
|
@ -878,7 +862,6 @@ DEPENDENCIES
|
|||
listen
|
||||
lograge
|
||||
logstash-event
|
||||
mailjet
|
||||
maintenance_tasks
|
||||
matrix
|
||||
memory_profiler
|
||||
|
|
|
@ -68,7 +68,6 @@ module Manager
|
|||
@user = User.find(params[:id])
|
||||
|
||||
email_services = [
|
||||
Mailjet::API.new,
|
||||
Sendinblue::API.new,
|
||||
Dolist::API.new
|
||||
]
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
class Mailjet::API
|
||||
def properly_configured?
|
||||
Mailjet.respond_to?(:config) && [Mailjet.config.api_key, Mailjet.config.secret_key].all?(&:present?)
|
||||
end
|
||||
|
||||
# Get messages sent to a user through SendInBlue.
|
||||
#
|
||||
# Returns an array of SentMail objects.
|
||||
def sent_mails(email_address)
|
||||
contact = Mailjet::Contact.find(email_address)
|
||||
if contact.nil?
|
||||
Rails.logger.info "Mailjet::API: no contact found for email address '#{email_address}'"
|
||||
return []
|
||||
end
|
||||
|
||||
messages = Mailjet::Message.all(
|
||||
contact: contact.attributes['id'],
|
||||
from_ts: 30.days.ago.to_datetime.rfc3339,
|
||||
show_subject: true
|
||||
)
|
||||
|
||||
messages.map do |message|
|
||||
SentMail.new(
|
||||
from: nil,
|
||||
to: email_address,
|
||||
subject: message.attributes['subject'],
|
||||
delivered_at: message.attributes['arrived_at'],
|
||||
status: message.attributes['status'],
|
||||
service_name: 'Mailjet',
|
||||
external_url: 'https://app.mailjet.com/contacts/subscribers/contact_list'
|
||||
)
|
||||
end
|
||||
rescue Mailjet::ApiError => e
|
||||
Rails.logger.error e.message
|
||||
[]
|
||||
end
|
||||
end
|
|
@ -17,7 +17,6 @@ class InstructeurMailer < ApplicationMailer
|
|||
@overview = instructeur.last_week_overview
|
||||
|
||||
if @overview.present?
|
||||
headers['X-mailjet-campaign'] = 'last_week_overview'
|
||||
mail(to: email, subject: @subject)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -22,9 +22,7 @@
|
|||
<p>
|
||||
Cet historique contient les 30 derniers jours.
|
||||
Pour un recherche plus fine, il faut fouiller les
|
||||
<a href="https://app-smtp.sendinblue.com/log">logs de SendInblue</a>
|
||||
ou
|
||||
<a href="https://app.mailjet.com/contacts/subscribers/contact_list">de Mailjet</a>.
|
||||
<a href="https://app-smtp.sendinblue.com/log">logs de SendInblue</a>.
|
||||
</p>
|
||||
<table>
|
||||
<thead>
|
||||
|
@ -71,9 +69,7 @@
|
|||
<% else %>
|
||||
<p>Historique indisponible. Cette adresse email n’existe pas chez nos prestataires d’envoi, ou nous n’avons pas réussi à en charger des données.
|
||||
Vous pouvez éventuellement fouiller les
|
||||
<a href="https://app-smtp.sendinblue.com/log">logs de SendInBlue</a>
|
||||
ou
|
||||
<a href="https://app.mailjet.com/contacts/subscribers/contact_list">de Mailjet</a>.
|
||||
<a href="https://app-smtp.sendinblue.com/log">logs de SendInBlue</a>.
|
||||
</p>
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -78,10 +78,6 @@ MATOMO_DOMAIN="*.www.demarches-simplifiees.fr"
|
|||
MATOMO_ID=""
|
||||
MATOMO_HOST="matomo.example.org"
|
||||
|
||||
# Default SMTP Provider: Mailjet
|
||||
MAILJET_API_KEY=""
|
||||
MAILJET_SECRET_KEY=""
|
||||
|
||||
# Alternate SMTP Provider: SendInBlue/DoList
|
||||
SENDINBLUE_CLIENT_KEY=""
|
||||
SENDINBLUE_SMTP_KEY=""
|
||||
|
|
|
@ -113,8 +113,7 @@ Rails.application.configure do
|
|||
ActionMailer::Base.add_delivery_method :balancer, BalancerDeliveryMethod
|
||||
config.action_mailer.balancer_settings = {
|
||||
sendinblue: sendinblue_weigth,
|
||||
dolist_api: dolist_api_weight,
|
||||
mailjet: 100 - (sendinblue_weigth + dolist_api_weight)
|
||||
dolist_api: dolist_api_weight
|
||||
}
|
||||
config.action_mailer.delivery_method = :balancer
|
||||
end
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
ActiveSupport.on_load(:action_mailer) do
|
||||
require 'mailjet'
|
||||
|
||||
Mailjet.configure do |config|
|
||||
config.api_key = Rails.application.secrets.mailjet[:api_key]
|
||||
config.secret_key = Rails.application.secrets.mailjet[:secret_key]
|
||||
config.default_from = CONTACT_EMAIL
|
||||
end
|
||||
end
|
|
@ -35,9 +35,6 @@ defaults: &defaults
|
|||
token_endpoint: <%= ENV['AGENT_CONNECT_BASE_URL'] %>/api/v2/token
|
||||
userinfo_endpoint: <%= ENV['AGENT_CONNECT_BASE_URL'] %>/api/v2/userinfo
|
||||
logout_endpoint: <%= ENV['AGENT_CONNECT_BASE_URL'] %>/api/v2/session/end
|
||||
mailjet:
|
||||
api_key: <%= ENV['MAILJET_API_KEY'] %>
|
||||
secret_key: <%= ENV['MAILJET_SECRET_KEY'] %>
|
||||
dolist:
|
||||
username: <%= ENV['DOLIST_USERNAME'] %>
|
||||
password: <%= ENV['DOLIST_PASSWORD'] %>
|
||||
|
|
Loading…
Reference in a new issue