From 0955d3e95645b85fda791b2cef9c25684f7e1db4 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Mon, 7 Mar 2016 13:30:01 +0100 Subject: pullimap: add an option '--no-delivery' to prevent SMTP/LMTP delivery. --- pullimap | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pullimap b/pullimap index 2b81d8f..692ec38 100755 --- a/pullimap +++ b/pullimap @@ -47,7 +47,7 @@ sub usage(;$) { exit $rv; } -usage(1) unless GetOptions(\%CONFIG, qw/config=s quiet|q debug help|h idle:i/); +usage(1) unless GetOptions(\%CONFIG, qw/config=s quiet|q debug help|h idle:i no-delivery/); usage(0) if $CONFIG{help}; usage(1) unless $#ARGV == 0 and $ARGV[0] ne '_'; @@ -134,7 +134,7 @@ sub sendmail($$) { unless (defined $SMTP) { # TODO we need to be able to reconnect when the server closes # the connection due to a timeout (RFC 5321 section 4.5.3.2) - my ($fam, $addr, $port) = (PF_INET, $CONF->{'deliver-method'}, 25); + my ($fam, $addr, $port) = (PF_INET, $CONF->{'deliver-method'} // 'smtp:[127.0.0.1]:10024', 25); $addr =~ s/^([ls]mtp):// or die; my $ehlo = $1 eq 'lmtp' ? 'LHO' : $1 eq 'smtp' ? 'EHLO' : die; $ehlo .= ' '. ($CONF->{'deliver-ehlo'} // 'localhost.localdomain'); @@ -252,7 +252,7 @@ sub pull(;$) { $from = (defined $from and @$from) ? $from->[0]->[2].'@'.$from->[0]->[3] : ''; print STDERR "($MAILBOX): UID $uid from <$from> ($mail->{INTERNALDATE})\n" unless $CONFIG{quiet}; - sendmail($from, $mail->{RFC822}); + sendmail($from, $mail->{RFC822}) unless $CONFIG{'no-delivery'}; push @uid, $uid; writeUID($uid); -- cgit v1.2.3