aboutsummaryrefslogtreecommitdiffstats
path: root/pullimap
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2016-03-07 13:30:01 +0100
committerGuilhem Moulin <guilhem@fripost.org>2016-03-07 13:30:01 +0100
commit0955d3e95645b85fda791b2cef9c25684f7e1db4 (patch)
tree29b719c81a050ad829c1a2fa403b34154a954f43 /pullimap
parenta3e21af7367cdd09e5260bcda90e79ae0ff00317 (diff)
pullimap: add an option '--no-delivery' to prevent SMTP/LMTP delivery.
Diffstat (limited to 'pullimap')
-rwxr-xr-xpullimap6
1 files 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);