sending email
This commit is contained in:
parent
8cf006e125
commit
80dee7f4e7
12 changed files with 339 additions and 35 deletions
|
@ -1,32 +0,0 @@
|
|||
require_dependency 'maildropserializator'
|
||||
class Customer < ActiveRecord::Base
|
||||
include MaildropSerializator
|
||||
|
||||
has_many :filters, :order => "order_num"
|
||||
has_one :mail_pref
|
||||
attr_accessor :password
|
||||
|
||||
def mail_temporary_path
|
||||
"#{CDF::CONFIG[:mail_temp_path]}/#{self.email}"
|
||||
end
|
||||
|
||||
def friendlly_local_email
|
||||
encode_email("#{self.fname} #{self.lname}", check_for_domain(email))
|
||||
end
|
||||
|
||||
def mail_filter_path
|
||||
"#{CDF::CONFIG[:mail_filters_path]}/#{self.email}"
|
||||
end
|
||||
|
||||
def local_email
|
||||
self.email
|
||||
end
|
||||
|
||||
def check_for_domain(email)
|
||||
if email and !email.nil? and !email.include?("@")
|
||||
email + "@" + CDF::CONFIG[:send_from_domain]
|
||||
else
|
||||
email
|
||||
end
|
||||
end
|
||||
end
|
|
@ -124,9 +124,9 @@ class CDF::Mail
|
|||
}
|
||||
encmail = m.encoded
|
||||
RAILS_DEFAULT_LOGGER.debug("Sending message \n #{encmail}")
|
||||
Net::SMTP.start(ActionMailer::Base.server_settings[:address], ActionMailer::Base.server_settings[:port],
|
||||
ActionMailer::Base.server_settings[:domain], ActionMailer::Base.server_settings[:user_name],
|
||||
ActionMailer::Base.server_settings[:password], ActionMailer::Base.server_settings[:authentication]) do |smtp|
|
||||
Net::SMTP.start(ActionMailer::Base.smtp_settings[:address], ActionMailer::Base.smtp_settings[:port],
|
||||
ActionMailer::Base.smtp_settings[:domain], ActionMailer::Base.smtp_settings[:user_name],
|
||||
ActionMailer::Base.smtp_settings[:password], ActionMailer::Base.smtp_settings[:authentication]) do |smtp|
|
||||
smtp.sendmail(encmail, m.from, m.destinations)
|
||||
end
|
||||
return encmail
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue