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'
|
||||||
|
|
|
@ -10,8 +10,7 @@ class Observer::Ticket::Article::CommunicateEmail::BackgroundJob
|
||||||
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,
|
||||||
|
|
|
@ -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