diff options
Diffstat (limited to 'pullimap')
-rwxr-xr-x | pullimap | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -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; } |