Class: HTMLgun

Inherits:
Object
  • Object
show all
Defined in:
lib/htmlgun.rb

Class Method Summary collapse

Class Method Details

.init(api_key, api_url = "https://mailgun.net/api/") ⇒ Object



6
7
8
# File 'lib/htmlgun.rb', line 6

def self.init(api_key, api_url = "https://mailgun.net/api/")
  Mailgun::init api_key, api_url
end

.send_html(the_sender, the_recipient, the_subject, the_body) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/htmlgun.rb', line 10

def self.send_html the_sender, the_recipient, the_subject,the_body
    mail = Mail.new do 
      from    the_sender
      to      the_recipient
      subject the_subject

      html_part do
        content_type "text/html; charset=UTF-8"
        body the_body
      end
    end

    MailgunMessage::send_raw( the_sender, the_recipient, mail.to_s )
end