class EMail::Client
- EMail::Client
- Reference
- Object
Overview
SMTP client object.
Client configuration
EMail::Client::Config object is used to set client configrations.
Logging
Without client specific logger in EMail::Client::Config, all EMail::Client objects use the default logger.
The default logger can be got by EMail::Client.log You can set log level, output IO, and log formatter for the default logger by using EMail::Client.log_level=, EMail::Client.log_io=, EMail::Client.log_formatter= methods respectively.
Defined in:
email/client.cremail/client/config.cr
Constructors
-
.new(config : EMail::Client::Config, number : Int32 | Nil = nil)
Creates smtp client object by EMail::Client::Config object.
Class Method Summary
-
.log : Log
Gets default logger(Log type object) to output SMTP log.
-
.log_formatter=(new_formatter : Log::Formatter)
Sets log formatter for default logger.
-
.log_io=(new_io : IO)
Sets log io for default logger.
-
.log_level=(new_level : Log::Severity)
Sets log level for default logger.
Instance Method Summary
-
#config : EMail::Client::Config
Gets cliet config object.
-
#send(mail : EMail::Message) : Bool
Sends a email message
-
#start(&)
Starts SMTP session.
Constructor Detail
Creates smtp client object by EMail::Client::Config object.
Class Method Detail
Instance Method Detail
Sends a email message
You can call this only in the block of the EMail::Client#start
method.
This retruns sending result as Bool(true
for success, false
for fail).