Welcome Guest, Not a member yet? Register   Sign In
"mail" method, content-type headers are put incorrectly
#1

[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?
#2

[eluser]Dam1an[/eluser]
[quote author="ilovechriswalken" date="1246916843"]
Version: CI 2 Beta[/quote]

Wait! What?
#3

[eluser]Unknown[/eluser]
Sorry, I got the versions confused with Redux Auth -- checking both CI and Redux for the very first time simultaneously. Obviously, I was talking about 1.7.1.
#4

[eluser]Trae R.[/eluser]
I can also recreate the above mentioned bug with HTML email and $config['protocol'] = 'mail'.

$config['protocol'] = 'sendmail' works properly / as expected though.
#5

[eluser]Brandon Jones[/eluser]
Hey ilovechriswalken, did you file a bug for this? Still looks like an issue in 1.7.2.




Theme © iAndrew 2016 - Forum software by © MyBB