Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions drivers/place/smtp.cr
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Place::Smtp < PlaceOS::Driver
# host: "smtp.host",
# port: 587,
tls_mode: EMail::Client::TLSMode::STARTTLS.to_s,
ssl_verify_ignore: false,
username: "", # Username/Password for SMTP servers with basic authorization
password: "",

Expand All @@ -41,6 +42,7 @@ class Place::Smtp < PlaceOS::Driver
@port : Int32 = 587
@tls_mode : EMail::Client::TLSMode = EMail::Client::TLSMode::STARTTLS
@send_lock : Mutex = Mutex.new
@ssl_verify_ignore : Bool = false

def on_load
on_update
Expand All @@ -62,6 +64,7 @@ class Place::Smtp < PlaceOS::Driver
@host = setting?(String, :host) || host
@port = setting?(Int32, :port) || port
@tls_mode = setting?(EMail::Client::TLSMode, :tls_mode) || tls_mode
@ssl_verify_ignore = setting?(Bool, :ssl_verify_ignore) || false

@smtp_client = new_smtp_client

Expand All @@ -79,6 +82,7 @@ class Place::Smtp < PlaceOS::Driver
end

email_config.use_tls(@tls_mode)
email_config.tls_context.verify_mode = OpenSSL::SSL::VerifyMode::None if @ssl_verify_ignore

EMail::Client.new(email_config)
end
Expand Down