Class: Helper::Mail
- Inherits:
-
Object
- Object
- Helper::Mail
- Defined in:
- lib/depengine/helper/mail.rb
Instance Attribute Summary collapse
-
#smtp_host ⇒ Object
Returns the value of attribute smtp_host.
-
#smtp_port ⇒ Object
Returns the value of attribute smtp_port.
Instance Method Summary collapse
-
#initialize ⇒ Mail
constructor
A new instance of Mail.
- #sendmail(options = {}) ⇒ Object
Constructor Details
#initialize ⇒ Mail
Returns a new instance of Mail.
8 9 10 11 |
# File 'lib/depengine/helper/mail.rb', line 8 def initialize smtp_host = 'localhost' if not smtp_host smtp_port = 25 if not smtp_port end |
Instance Attribute Details
#smtp_host ⇒ Object
Returns the value of attribute smtp_host.
5 6 7 |
# File 'lib/depengine/helper/mail.rb', line 5 def smtp_host @smtp_host end |
#smtp_port ⇒ Object
Returns the value of attribute smtp_port.
6 7 8 |
# File 'lib/depengine/helper/mail.rb', line 6 def smtp_port @smtp_port end |
Instance Method Details
#sendmail(options = {}) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/depengine/helper/mail.rb', line 13 def sendmail(={}) begin Pony.mail( \ :from => [:from], :to => [:to], :via => :smtp, :via_options => { :address => smtp_host, :port => smtp_port, :authentication => nil, :enable_starttls_auto => false }, :subject => [:subject], :body => [:body] ) rescue Exception => e $log.writer.error "Can not send mail via host #{smtp_host}" $log.writer.error e. end end |