lib/depengine/helper/mail.rb in depengine-3.0.12 vs lib/depengine/helper/mail.rb in depengine-3.0.13
- old
+ new
@@ -1,22 +1,29 @@
module Helper
class Mail
- attr_accessor :smtp_host
- attr_accessor :smtp_port
+ attr_accessor :smtp_host, :smtp_port
def initialize
- smtp_host = 'localhost' if not smtp_host
- smtp_port = 25 if not smtp_port
+ smtp_host ||= 'localhost'
+ smtp_port ||= 25
end
+ # Sends an email via smtp.
+ #
+ # Parameters:
+ # * +options+ - a hash with needed configuration options for the email
+ # * +:from+ - the senders address
+ # * +:to+ - the recipiants address
+ # * +:subject+ - the email subject
+ # * +:body+ - the actual text to send in the mail
def sendmail(options={})
begin
Pony.mail( \
:from => options[:from],
:to => options[:to],
- :via => :smtp,
+ :via => :smtp,
:via_options => {
:address => smtp_host,
:port => smtp_port,
:authentication => nil,
:enable_starttls_auto => false