class EMail::Client

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.cr
email/client/config.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(config : EMail::Client::Config, number = nil) #

Creates smtp client object by EMail::Client::Config object.


[View source]

Class Method Detail

def self.log : Log #

Gets default logger(Log type object) to output SMTP log.


[View source]
def self.log_formatter=(new_formatter : Log::Formatter) #

Sets log formatter for default logger.


[View source]
def self.log_io=(new_io : IO) #

Sets log io for default logger.


[View source]
def self.log_level=(new_level : Log::Severity) #

Sets log level for default logger.


[View source]

Instance Method Detail

def config : EMail::Client::Config #

Gets cliet config object.


[View source]
def send(mail : EMail::Message) : Bool #

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).


[View source]
def start(&) #

Starts SMTP session.

In the block, the default receiver will be self.


[View source]