Module: Email::RunnerMethods
- Includes:
- TMail
- Defined in:
- lib/plugins/email.rb
Instance Method Summary collapse
-
#email(subject, body, to = nil) ⇒ Object
Send a multipart html email, converting html to text for plain_text emails In Uses Tmail.
Instance Method Details
#email(subject, body, to = nil) ⇒ Object
Send a multipart html email, converting html to text for plain_text emails In Uses Tmail
mail('test resutls', '<html><body>Good results!</body></html>')
16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/plugins/email.rb', line 16 def email(subject,body,to=nil) part = Mail.new part.set_content_type "text", "html" part.body = body.to_html mail = Mail.new mail.to = to mail.from = "rgithook@#{Socket.gethostname}" mail.subject = subject mail.body = body.gsub('</p>',"\n").gsub('</br>',"\n").gsub(/<\/?[^>]*>/, "") mail.parts << part mail sendmail(mail) mail end |