Fix email config
This commit is contained in:
@@ -10,26 +10,29 @@ module Adamantium
|
|||||||
@from = from
|
@from = from
|
||||||
end
|
end
|
||||||
|
|
||||||
|
attr_reader :username, :password, :to, :from
|
||||||
|
|
||||||
def call(name:, content:)
|
def call(name:, content:)
|
||||||
Mail.defaults do
|
Mail.defaults do
|
||||||
delivery_method :smtp, {
|
delivery_method :smtp, {
|
||||||
address: "smtp.fastmail.com",
|
address: "smtp.fastmail.com",
|
||||||
port: 465,
|
port: 465,
|
||||||
user_name: @username,
|
|
||||||
password: @password,
|
|
||||||
authentication: "plain",
|
authentication: "plain",
|
||||||
tls: true,
|
tls: true,
|
||||||
openssl_verify_mode: "peer"
|
openssl_verify_mode: "peer"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Mail.delivery_method.settings[:user_name] = username
|
||||||
|
Mail.delivery_method.settings[:password] = password
|
||||||
|
|
||||||
mail = Mail.new do
|
mail = Mail.new do
|
||||||
subject name
|
subject name
|
||||||
body content
|
body content
|
||||||
end
|
end
|
||||||
|
|
||||||
mail[:to] = @to
|
mail[:to] = to
|
||||||
mail[:from] = @username
|
mail[:from] = username
|
||||||
|
|
||||||
mail.deliver
|
mail.deliver
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user