Module: Ronin::Support::Network::ESMTP::Mixin

Includes:
SMTP::Mixin
Defined in:
lib/ronin/support/network/esmtp/mixin.rb

Overview

Provides helper methods for communicating with ESMTP services.

Constant Summary

Constants included from SMTP::Mixin

SMTP::Mixin::DEFAULT_PORT

Instance Method Summary collapse

Methods included from SMTP::Mixin

message, #smtp_connect, #smtp_message, #smtp_send_message

Methods included from SSL::Mixin

#ssl_accept, #ssl_banner, #ssl_cert, #ssl_connect, #ssl_connect_and_send, #ssl_context, #ssl_open?, #ssl_send, #ssl_server, #ssl_server_loop, #ssl_server_session, #ssl_server_socket, #ssl_socket

Instance Method Details

#esmtp_connect(host, **kwargs) {|esmtp| ... } ⇒ Net::SMTP?

Creates a connection to the ESMTP server.

Parameters:

  • host (String)

    The host to connect to.

  • kwargs (Hash{Symbol => Object})

    Additional keyword arguments for SMTP::Mixin#smtp_connect.

  • :ssl (Hash)

    a customizable set of options

Options Hash (**kwargs):

  • :port (Integer) — default: SMTP::DEFAULT_PORT

    The port to connect to.

  • :ssl (Boolean, Hash)

    Additional SSL options.

  • :helo (String)

    The HELO domain.

  • :auth (Symbol)

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

    • :login
    • :plain
    • :cram_md5
  • :user (String)

    The user-name to authenticate with.

  • :password (String)

    The password to authenticate with.

Yields:

  • (esmtp)

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

Yield Parameters:

  • esmtp (Net::SMTP)

    The ESMTP session.

Returns:

  • (Net::SMTP, nil)

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



99
100
101
102
103
104
105
106
107
108
109
110
111
# 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) ⇒ SMTP::Email

Parameters:

Returns:

See Also:

  • SMTP.message


44
45
46
# File 'lib/ronin/support/network/esmtp/mixin.rb', line 44

def esmtp_message(**kwargs,&block)
  smtp_message(**kwargs,&block)
end