From 915c87db9b6cf1615594e34a89e8c370fd560e59 Mon Sep 17 00:00:00 2001 From: Daniel Nitsikopoulos Date: Wed, 8 Mar 2023 20:28:15 +1100 Subject: [PATCH] Fix email config --- lib/adamantium/syndication/dayone.rb | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/adamantium/syndication/dayone.rb b/lib/adamantium/syndication/dayone.rb index 2e950bc..e071224 100644 --- a/lib/adamantium/syndication/dayone.rb +++ b/lib/adamantium/syndication/dayone.rb @@ -10,26 +10,29 @@ module Adamantium @from = from end + attr_reader :username, :password, :to, :from + def call(name:, content:) Mail.defaults do delivery_method :smtp, { address: "smtp.fastmail.com", port: 465, - user_name: @username, - password: @password, authentication: "plain", tls: true, openssl_verify_mode: "peer" } end + Mail.delivery_method.settings[:user_name] = username + Mail.delivery_method.settings[:password] = password + mail = Mail.new do subject name body content end - mail[:to] = @to - mail[:from] = @username + mail[:to] = to + mail[:from] = username mail.deliver end