bug-mailutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Quick Lisp DSN detection


From: Jean Louis
Subject: Quick Lisp DSN detection
Date: Thu, 17 Jun 2021 11:36:24 +0300

For now I use Common Lisp to detect DSN and find email in
"Final-Recipient:" and this seem to work for now:

(defun mutt-daemon ()
  (let ((count 0)
        (email))
    (with-open-stream (text *standard-input*)
      (loop for line = (read-line text nil nil)
            while line do 
              (when (or (regexp:match "^Final-Recipient: " line :ignore-case t)
                        (regexp:match "^Return-Path: +<>: " line :ignore-case t)
                        (regexp:match 
"^multipart/report.*report-type=delivery-status" line :ignore-case t)
                        (regexp:match "^Action:.*failed" line :ignore-case t)
                        (regexp:match "^Status:.*5" line :ignore-case t))
                (setq count (1+ count))
                (when (regexp:match "^Final-Recipient: " line :ignore-case t)
                  (setq email line)))))
    (let ((email (string-last-part-after-space email)))
      (when (and email (search "@" email))
        (unsubscribe-contact-for-email email)))))

it would be nicer to simply use grep and bash script.


Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]