From 69e2f637222f81fd538809ef48f77d5334ef9c71 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Tue, 8 Mar 2016 17:49:47 +0100 Subject: [PATCH] pullimap: don't FETCH messages BODY if --no-delivery is set. --- pullimap | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pullimap b/pullimap index d2de66f..c3fd4a0 100755 --- a/pullimap +++ b/pullimap @@ -254,7 +254,8 @@ sub purge() { # Use BODY.PEEK[] so if something gets wrong, unpulled messages # won't be marked as \Seen in the mailbox -my $ATTRS = "ENVELOPE INTERNALDATE BODY.PEEK[]"; +my $ATTRS = "ENVELOPE INTERNALDATE"; +$ATTRS .= " BODY.PEEK[]" unless $CONFIG{'no-delivery'}; # Pull new messages from IMAP and deliver them to SMTP, then update the # statefile @@ -265,7 +266,7 @@ sub pull(;$) { # invariant: we're at pos 8 + 4*(1+$#ignore + 1+$#uids) in the statefile $IMAP->pull_new_messages($ATTRS, sub($) { my $mail = shift; - return unless exists $mail->{RFC822}; # not for us + return unless exists $mail->{RFC822} or $CONFIG{'no-delivery'}; # not for us my $uid = $mail->{UID}; my $from = first { defined $_ and @$_ } @{$mail->{ENVELOPE}}[2,3,4]; -- 2.39.2