Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix redundant CRLF sequence when it's already in the message stream #16

Merged
merged 1 commit into from Jul 28, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 8 additions & 1 deletion Net/SMTP.php
Expand Up @@ -1086,6 +1086,8 @@ function data($data, $headers = null)
return $result;
}
}

$last = $line;
} else {
/*
* Break up the data by sending one chunk (up to 512k) at a time.
Expand Down Expand Up @@ -1121,10 +1123,15 @@ function data($data, $headers = null)
/* Advance the offset to the end of this chunk. */
$offset = $end;
}

$last = $chunk;
}

/* Don't add another CRLF sequence if it's already in the data */
$terminator = (substr($last, -2) == "\r\n" ? '' : "\r\n") . ".\r\n";

/* Finally, send the DATA terminator sequence. */
if (PEAR::isError($result = $this->_send("\r\n.\r\n"))) {
if (PEAR::isError($result = $this->_send($terminator))) {
return $result;
}

Expand Down