aboutsummaryrefslogtreecommitdiffstats
path: root/pullimap
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2016-03-08 00:05:32 +0100
committerGuilhem Moulin <guilhem@fripost.org>2016-03-08 00:05:32 +0100
commitaecdd0c6657e3edb0482751efffdcafb96f2c2c5 (patch)
tree1f7363eb675708480c635200f3610e6c2c16f6bc /pullimap
parent792d841f2993a76276e16d7228858b16e3deb98a (diff)
parentd0d439750b572250ae00b595d9a742ccbb7b8a4e (diff)
Merge branch 'master' into debian
Diffstat (limited to 'pullimap')
-rwxr-xr-xpullimap10
1 files changed, 7 insertions, 3 deletions
diff --git a/pullimap b/pullimap
index 27226d2..0e31a90 100755
--- a/pullimap
+++ b/pullimap
@@ -124,7 +124,7 @@ sub sendmail($$) {
# the connection due to a timeout (RFC 5321 section 4.5.3.2)
my ($fam, $addr) = (PF_INET, $CONF->{'deliver-method'} // 'smtp:[127.0.0.1]:25');
$addr =~ s/^([ls]mtp):// or die;
- my $ehlo = $1 eq 'lmtp' ? 'LHO' : $1 eq 'smtp' ? 'EHLO' : die;
+ my $ehlo = $1 eq 'lmtp' ? 'LHLO' : $1 eq 'smtp' ? 'EHLO' : die;
$ehlo .= ' '. ($CONF->{'deliver-ehlo'} // 'localhost.localdomain');
my $port = $addr =~ s/:(\d+)$// ? $1 : die;
@@ -219,7 +219,11 @@ sub smtp_send(@) {
# the remote mailbox
#
$CONF->{'logger-fd'} = \*STDERR if $CONFIG{debug};
-my $IMAP = Net::IMAP::InterIMAP::->new( %$CONF, %CONFIG{qw/quiet debug/} );
+my $IMAP = do {
+ my %config = (%$CONF, %CONFIG{qw/quiet debug/}, name => $ARGV[0]);
+ $config{keepalive} = 1 if defined $CONFIG{idle} and $config{type} ne 'tunnel';
+ Net::IMAP::InterIMAP::->new( %config );
+};
# Remove messages with UID < UIDNEXT and INTERNALDATE at most
# $CONF->{'purge-after'} days ago.
@@ -266,7 +270,7 @@ sub pull(;$) {
my $uid = $mail->{UID};
my $from = first { defined $_ and @$_ } @{$mail->{ENVELOPE}}[2,3,4];
$from = (defined $from and @$from) ? $from->[0]->[2].'@'.$from->[0]->[3] : '';
- print STDERR "($MAILBOX): UID $uid from <$from> ($mail->{INTERNALDATE})\n" unless $CONFIG{quiet};
+ $IMAP->log("UID $uid from <$from> ($mail->{INTERNALDATE})") unless $CONFIG{quiet};
sendmail($from, $mail->{RFC822}) unless $CONFIG{'no-delivery'};