diff options
Diffstat (limited to 'app/models/exim_log.rb')
-rw-r--r-- | app/models/exim_log.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/models/exim_log.rb b/app/models/exim_log.rb index ac3cb11a3..e7f4a4e8d 100644 --- a/app/models/exim_log.rb +++ b/app/models/exim_log.rb @@ -74,6 +74,19 @@ class EximLog < ActiveRecord::Base end end + def EximLog.scan_for_postfix_queue_ids(f) + result = {} + f.each do |line| + email_domain = Configuration::incoming_email_domain + emails = line.scan(/request-[^\s]+@#{email_domain}/).sort.uniq + # Assume the log file was written using syslog and parse accordingly + queue_id = SyslogProtocol.parse("<13>" + line).content.match(/^\S+: (\S+):/)[1] + result[queue_id] = [] unless result.has_key?(queue_id) + result[queue_id] = (result[queue_id] + emails).uniq + end + result + end + # Check that the last day of requests has been sent in Exim and we got the # lines. Writes any errors to STDERR. This check is really mainly to # check the envelope from is the request address, as Ruby is quite |