Module: LeanMail

Defined in:
contrib/lib/lean_mail.rb

Overview

Send an email with SMTP easily.

Environment variables:

  • SMTP_HOST: Where to connect to.
  • SMTP_PORT: Port, optional (default: 25).
  • SMTP_SECURITY: tls or starttls, optional (default: nil).
  • SMTP_USER: User, optional.
  • SMTP_PASSWORD: Password, optional.
  • SMTP_FROM: In the format Name <user@mail> or user@mail.

Examples:

Single address

LeanMail.deliver('to@mail', 'subject', 'body')

Multiple addresses

LeanMail.deliver(['to@mail', 'to2@mail'], 'subject', 'body')

Defined Under Namespace

Classes: Data, Deliver

Class Method Summary collapse

Class Method Details

.deliver(to, subject, body) ⇒ Deliver

Deliver email.

Parameters:

  • to (Array, String)

    In the format Name <user@mail> or user@mail.

  • subject (String)
  • body (String)

Returns:



122
123
124
# File 'contrib/lib/lean_mail.rb', line 122

def self.deliver(to, subject, body)
  LeanMail::Deliver.new.call(to, subject, body)
end