Moved sieve-message-bounce to sieve-core.scm
Showing
1 changed file
with
1 additions
and
39 deletions
... | @@ -17,45 +17,6 @@ | ... | @@ -17,45 +17,6 @@ |
17 | 17 | ||
18 | ;;;; This module provides sieve's "redirect" action. | 18 | ;;;; This module provides sieve's "redirect" action. |
19 | 19 | ||
20 | (use-modules (ice-9 popen)) | ||
21 | |||
22 | (define PATH-SENDMAIL "/usr/lib/sendmail") | ||
23 | (define sieve-my-email "") | ||
24 | |||
25 | ;;; Bounce a message. | ||
26 | ;;; Current mailutils API does not provide a way to send a message | ||
27 | ;;; specifying its recipients (like "sendmail -t foo@bar.org" does), | ||
28 | ;;; hence the need for this function. | ||
29 | (define (sieve-message-bounce message addr-list) | ||
30 | (catch #t | ||
31 | (lambda () | ||
32 | (let ((port (open-output-pipe | ||
33 | (apply string-append | ||
34 | (append | ||
35 | (list | ||
36 | PATH-SENDMAIL | ||
37 | " -oi -t ") | ||
38 | (map | ||
39 | (lambda (addr) | ||
40 | (string-append addr " ")) | ||
41 | addr-list)))))) | ||
42 | ;; Write headers | ||
43 | (for-each | ||
44 | (lambda (hdr) | ||
45 | (display (string-append (car hdr) ": " (cdr hdr)) port) | ||
46 | (newline port)) | ||
47 | (mu-message-get-header-fields message)) | ||
48 | (newline port) | ||
49 | ;; Write body | ||
50 | (let ((body (mu-message-get-body message))) | ||
51 | (do ((line (mu-body-read-line body) (mu-body-read-line body))) | ||
52 | ((eof-object? line) #f) | ||
53 | (display line port))) | ||
54 | (close-output-port port))) | ||
55 | (lambda args | ||
56 | (runtime-error LOG_ERR "redirect: Can't send message") | ||
57 | (write args)))) | ||
58 | |||
59 | ;;; rfc3028 says: | 20 | ;;; rfc3028 says: |
60 | ;;; "Implementations SHOULD take measures to implement loop control," | 21 | ;;; "Implementations SHOULD take measures to implement loop control," |
61 | ;;; We do this by appending an "X-Sender" header to each message | 22 | ;;; We do this by appending an "X-Sender" header to each message |
... | @@ -91,3 +52,4 @@ | ... | @@ -91,3 +52,4 @@ |
91 | (sieve-register-action "redirect" action-redirect 'string)) | 52 | (sieve-register-action "redirect" action-redirect 'string)) |
92 | 53 | ||
93 | 54 | ||
55 | ... | ... |
-
Please register or sign in to post a comment