Class: Magnesium::Mail

Inherits:
Object
  • Object
show all
Defined in:
lib/magnesium/extensions/mail.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#fromObject

Returns the value of attribute from.



9
10
11
# File 'lib/magnesium/extensions/mail.rb', line 9

def from
  @from
end

#msgObject

Returns the value of attribute msg.



8
9
10
# File 'lib/magnesium/extensions/mail.rb', line 8

def msg
  @msg
end

#serverObject

Returns the value of attribute server.



6
7
8
# File 'lib/magnesium/extensions/mail.rb', line 6

def server
  @server
end

#subjectObject

Returns the value of attribute subject.



7
8
9
# File 'lib/magnesium/extensions/mail.rb', line 7

def subject
  @subject
end

#toObject

Returns the value of attribute to.



10
11
12
# File 'lib/magnesium/extensions/mail.rb', line 10

def to
  @to
end

Class Method Details

.sendObject

(server,subject,msg,from,to)



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/magnesium/extensions/mail.rb', line 12

def self.send #(server,subject,msg,from,to)
  message = <<MESSAGE_END
From: <#{@from}>
To: <#{@to}>
Subject: #{@subject}

#{@msg}
MESSAGE_END

  Net::SMTP.start('#{@server}') do |smtp|
    smtp.send_message message, '#{@from}', '#{@to}'
  end
end