module Ronin::Support::Network::ESMTP::Mixin

Provides helper methods for communicating with ESMTP services.

Public Instance Methods

esmtp_connect(host,**kwargs) { |smtp| ... } click to toggle source

Creates a connection to the ESMTP server.

@param [String] host

The host to connect to.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments for {#smtp_connect}.

@option kwargs [Integer] :port (SMTP::DEFAULT_PORT)

The port to connect to.

@option kwargs [Boolean, Hash] :ssl

Additional SSL options.

@option :ssl [Boolean] :verify

Specifies that the SSL certificate should be verified.

@option :ssl [String] :certs

The path to the file containing CA certs of the server.

@option kwargs [String] :helo

The HELO domain.

@option kwargs [Symbol] :auth

The type of authentication to use.
May be one of the following:

* `:login`
* `:plain`
* `:cram_md5`

@option kwargs [String] :user

The user-name to authenticate with.

@option kwargs [String] :password

The password to authenticate with.

@yield [esmtp]

If a block is given, it will be passed an ESMTP enabled session.
Once the block returns the ESMTP session will be closed.

@yieldparam [Net::SMTP] esmtp

The ESMTP session.

@return [Net::SMTP, nil]

The ESMTP enabled session. If a block is given, `nil` will be
returned.

@api public

# File lib/ronin/support/network/esmtp/mixin.rb, line 99
def esmtp_connect(host,**kwargs)
  if block_given?
    smtp_connect(host,**kwargs) do |smtp|
      smtp.esmtp = true
      yield smtp
    end
  else
    smtp = smtp_connect(host,**kwargs)

    smtp.esmtp = true
    return smtp
  end
end
esmtp_message(**kwargs,&block) click to toggle source

Alias for {SMTP::Mixin#smtp_message}.

@param [Hash{Symbol => Object}] kwargs

Additional keyword arguments for {SMTP::Mixin#smtp_message}.

@return [SMTP::Email]

The new email object.

@see SMTP.message

@api public

# File lib/ronin/support/network/esmtp/mixin.rb, line 44
def esmtp_message(**kwargs,&block)
  smtp_message(**kwargs,&block)
end