Module: Platformx::Mail

Defined in:
lib/platformx/mail.rb

Overview

Mail module

Author:

  • Tim Mushen

Class Method Summary collapse

Class Method Details

.initObject

Conig mail



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/platformx/mail.rb', line 7

def self.init
    #Pony Configs
     Pony.options = { 
      :from => Platformx.configuration.mail_from,
      :via => :smtp,
      :via_options => {
        :from => Platformx.configuration.mail_from,
        :address => Platformx.configuration.mail_address,
        :port => Platformx.configuration.mail_port,
        :domain => Platformx.configuration.mail_domain,
        :user_name => Platformx.configuration.mail_user_name,
        :enable_starttls_auto => true,
        :password => Platformx.configuration.mail_password,
        :authentication => :login
      }
    }
end

.mail(to: "", cc: "", subject: "", html_body: "") ⇒ Object

Send mail

Parameters:

  • to (String) (defaults to: "")

    to addresses

  • cc (String) (defaults to: "")

    cc addresses

  • html_body (String) (defaults to: "")

    body of the message (in html)



29
30
31
32
33
34
35
36
37
# File 'lib/platformx/mail.rb', line 29

def self.mail(to: "", cc: "", subject: "", html_body: "")
    init
    Pony.mail(
      to: to, 
      cc: cc,
      subject: subject, 
      html_body: html_body
      )
end