Moved from class to module for sending emails.
This commit is contained in:
parent
465d18141e
commit
69420df8a5
4 changed files with 8 additions and 8 deletions
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
require 'net/imap'
|
require 'net/imap'
|
||||||
|
|
||||||
class Channel::EmailSend
|
module Channel::EmailSend
|
||||||
def send(attr, notification = false)
|
def self.send(attr, notification = false)
|
||||||
channel = Channel.where( :area => 'Email::Outbound', :active => true ).first
|
channel = Channel.where( :area => 'Email::Outbound', :active => true ).first
|
||||||
begin
|
begin
|
||||||
c = eval 'Channel::' + channel[:adapter] + '.new'
|
c = eval 'Channel::' + channel[:adapter] + '.new'
|
||||||
|
|
|
@ -6,12 +6,11 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob
|
||||||
record = Ticket::Article.find( @article_id )
|
record = Ticket::Article.find( @article_id )
|
||||||
|
|
||||||
# build subject
|
# build subject
|
||||||
ticket = Ticket.lookup( :id => record.ticket_id )
|
ticket = Ticket.lookup( :id => record.ticket_id )
|
||||||
subject = ticket.subject_build( record.subject )
|
subject = ticket.subject_build( record.subject )
|
||||||
|
|
||||||
# send email
|
# send email
|
||||||
a = Channel::EmailSend.new
|
message = Channel::EmailSend.send(
|
||||||
message = a.send(
|
|
||||||
{
|
{
|
||||||
:message_id => record.message_id,
|
:message_id => record.message_id,
|
||||||
:in_reply_to => record.in_reply_to,
|
:in_reply_to => record.in_reply_to,
|
||||||
|
@ -58,4 +57,4 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -236,4 +236,4 @@ class Observer::Ticket::Notification < ActiveRecord::Observer
|
||||||
# puts @a.inspect
|
# puts @a.inspect
|
||||||
# AuditTrail.new(record, "UPDATED")
|
# AuditTrail.new(record, "UPDATED")
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -95,7 +95,8 @@ module NotificationFactory
|
||||||
def self.send(data)
|
def self.send(data)
|
||||||
sender = Setting.get('notification_sender')
|
sender = Setting.get('notification_sender')
|
||||||
Rails.logger.info "NOTICE: SEND NOTIFICATION TO: #{data[:recipient][:email]} (from #{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,
|
# :in_reply_to => self.in_reply_to,
|
||||||
:from => sender,
|
:from => sender,
|
||||||
|
|
Loading…
Reference in a new issue