Skip to content
Snippets Groups Projects
Select Git revision
  • c37ee1d0f6e3a1039a1ccaf263f4f3be4b279072
  • master default
  • uiUpdates
  • 1.0.0
4 results

emailer.rb

Blame
  • Forked from Digital Experience Group / UNL Resource Scheduler
    Source project has a limited visibility.
    emailer.rb 658 B
    require 'pony'
    
    class Emailer
      def self.mail(to, subject, body, bcc = "", attachments = nil)
        Pony.mail({
          :to => to,
          :bcc => bcc,
          :subject => subject,
          :html_body => body,
          :from => 'resource_scheduler@unl.edu',
          :via => self.method,
          :via_options => self.method_options,
          :attachments => attachments
        })
      end
    
      private 
    
      def self.method
        if ENV['RACK_ENV'] == 'development'
          :smtp
        else
          :sendmail
        end
      end
    
      def self.method_options
        if ENV['RACK_ENV'] == 'development'
          {
            :address => '127.0.0.1',
            :port => '1025'
          }
        else
          {}
        end
      end
    end