aboutsummaryrefslogtreecommitdiffstats
path: root/pullimap
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2019-11-19 20:26:41 +0100
committerGuilhem Moulin <guilhem@fripost.org>2019-11-19 20:26:41 +0100
commit150c6cb82be94fc9abb0ecaff4615a2e2d6fdf68 (patch)
treec4cd0d284e631ab632b548ffb58a349372856812 /pullimap
parent3180560255e1d5821ea03570f54aa39e85608d5e (diff)
parent13337de269b207136e2462c3f1f7fbd842522a7c (diff)
Merge branch 'master' into debian
Diffstat (limited to 'pullimap')
-rwxr-xr-xpullimap13
1 files changed, 7 insertions, 6 deletions
diff --git a/pullimap b/pullimap
index 1dc4b9e..ee2168d 100755
--- a/pullimap
+++ b/pullimap
@@ -166,7 +166,7 @@ sub sendmail($$) {
);
print STDERR "C: [...]\n" if $CONFIG{debug};
- if ($$rfc822 eq '') {
+ if (!defined $$rfc822 or $$rfc822 eq "") {
# RFC 5321 section 4.1.1.4: if there was no mail data, the first
# "\r\n" ends the DATA command itself
$SMTP->printflush("\r\n.\r\n") or die;
@@ -175,17 +175,18 @@ sub sendmail($$) {
my $length = length($$rfc822);
while ((my $end = index($$rfc822, "\r\n", $offset) + 2) != 1) {
my $line = substr($$rfc822, $offset, $end-$offset);
- # RFC 5321 section 4.5.2: the character sequence "\r\n.\r\n"
- # ends the mail text and cannot be sent by the user
- $SMTP->print($line eq ".\r\n" ? "..\r\n" : $line) or die;
+ # RFC 5321 sec. 4.5.2: if the line starts with a dot, double it
+ $line = ".".$line if substr($line, 0, 1) eq ".";
+ $SMTP->print($line) or die;
$offset = $end;
}
if ($offset < $length) {
# the last line did not end with "\r\n"; add it in order to
# have the receiving SMTP server recognize the "end of data"
- # condition. See RFC 5321 section 4.1.1.4
+ # condition. See RFC 5321 sec. 4.1.1.4
my $line = substr($$rfc822, $offset);
- $SMTP->print(($line eq "." ? ".." : $line), "\r\n") or die;
+ $line = ".".$line if substr($line, 0, 1) eq ".";
+ $SMTP->print($line, "\r\n") or die;
}
$SMTP->printflush(".\r\n") or die;
}