Sha256: 2da8696eba1040f06fc1cb44dfef6deb9e8b2badba4fe6e4756e2d90ec95b4d0
Contents?: true
Size: 1.06 KB
Versions: 8
Compression:
Stored size: 1.06 KB
Contents
module Helper class Mail attr_accessor :smtp_host, :smtp_port def initialize 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_options => { :address => smtp_host, :port => smtp_port, :authentication => nil, :enable_starttls_auto => false }, :subject => options[:subject], :body => options[:body] ) rescue Exception => e $log.writer.error "Can not send mail via host #{smtp_host}" $log.writer.error e.message end end end end
Version data entries
8 entries across 8 versions & 1 rubygems