Moved from class to module for sending emails.

This commit is contained in:
Martin Edenhofer 2015-01-01 01:26:17 +01:00
parent 465d18141e
commit 69420df8a5
4 changed files with 8 additions and 8 deletions

View file

@ -2,8 +2,8 @@
require 'net/imap'
class Channel::EmailSend
def send(attr, notification = false)
module Channel::EmailSend
def self.send(attr, notification = false)
channel = Channel.where( :area => 'Email::Outbound', :active => true ).first
begin
c = eval 'Channel::' + channel[:adapter] + '.new'

View file

@ -6,12 +6,11 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob
record = Ticket::Article.find( @article_id )
# build subject
ticket = Ticket.lookup( :id => record.ticket_id )
ticket = Ticket.lookup( :id => record.ticket_id )
subject = ticket.subject_build( record.subject )
# send email
a = Channel::EmailSend.new
message = a.send(
message = Channel::EmailSend.send(
{
:message_id => record.message_id,
:in_reply_to => record.in_reply_to,
@ -58,4 +57,4 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob
)
end
end
end
end

View file

@ -236,4 +236,4 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
# puts @a.inspect
# AuditTrail.new(record, "UPDATED")
end
end
end

View file

@ -95,7 +95,8 @@ module NotificationFactory
def self.send(data)
sender = Setting.get('notification_sender')
Rails.logger.info "NOTICE: SEND NOTIFICATION TO: #{data[:recipient][:email]} (from #{sender})"
Channel::EmailSend.new.send(
Channel::EmailSend.send(
{
# :in_reply_to => self.in_reply_to,
:from => sender,