Module: BioDSL::EmailHelper
- Included in:
- Pipeline
- Defined in:
- lib/BioDSL/helpers/email_helper.rb
Overview
Namespace for EmailHelper.
Instance Method Summary collapse
-
#compose_mail(html_part) ⇒ Mail
Compose an email.
- #send_email(pipeline) ⇒ Object
Instance Method Details
#compose_mail(html_part) ⇒ Mail
Compose an email.
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/BioDSL/helpers/email_helper.rb', line 53 def compose_mail(html_part) mail = Mail.new mail[:from] = "do-not-reply@#{`hostname -f`.strip}" mail[:to] = @options[:email] mail[:subject] = @options[:subject] || to_s.first(30) mail.html_part = html_part mail.delivery_method :smtp, address: 'localhost', port: 25, enable_starttls_auto: false mail end |
#send_email(pipeline) ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/BioDSL/helpers/email_helper.rb', line 37 def send_email(pipeline) return unless @options[:email] html_part = Mail::Part.new do content_type 'text/html; charset=UTF-8' body BioDSL::HtmlReport.new(pipeline).to_html end compose_mail(html_part).deliver! end |