module BioDSL::EmailHelper
Namespace for EmailHelper
.
Public Instance Methods
compose_mail(html_part)
click to toggle source
Compose an email.
@param html_part [Mail::Part] The email body.
@return [Mail] Mail to be sent.
# 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)
click to toggle source
Send email notification to email address specfied in @options, including a optional subject specified in @options, that will otherwise default to self.to_s. The body of the email will be an HTML report.
@param pipeline [BioDSL::Pipeline] Pipeline
object
# 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