[eluser]Unknown[/eluser]
Not sure if this issue was raised before, I looked for it in the bug list and here on forum, found nothing.
Here goes:
Version: CI 1.7.1
Effect: When sending HTML email with the "mail" protocol, "Content-Type" and "Content-Transfer-Encoding" headers are put in the message body, not in the actual headers list.
Cause: (sorry, no lines, I have my printouts scattered all over the code)
system/libraries/Email.php
Code:
function _write_headers() {
...
if ($this->_get_protocol() == 'mail') {
$this->_header_str = substr($this->_header_str, 0, -1); // won't work when newline=\r\n
}
...
}
Now, as far as I understand, above code works in conjunction with this:
Code:
function _build_message() {
...
switch ($this->_get_content_type()) {
...
case 'html' :
if ($this->send_multipart === FALSE) {
$hdr .= "Content-Type: text/html; charset=" . $this->charset . $this->newline;
$hdr .= "Content-Transfer-Encoding: quoted-printable";
...
}
...
}
Anyway, what I did was an added check for newline value:
Code:
function _write_headers() {
...
if ($this->_get_protocol() == 'mail') {
if ($this->newline === "\r\n") {
$this->_header_str = substr($this->_header_str, 0, -2);
} else {
$this->_header_str = substr($this->_header_str, 0, -1);
}
}
...
}
I know it's messy, but it works for me.
Now, should I create a new bug for this one?