[eluser]a&w[/eluser]
This is pretty easy to verify if this is a bug or not. Just try to change the useragent and then do print_debugger() and you should see the useragent is not changed.
When you do:
Code:
$this->CI->email->initialize($config);
that will call:
Code:
function initialize($config = array())
{
$this->clear();
which then calls
Code:
function clear($clear_attachments = FALSE)
{
$this->_subject = "";
$this->_body = "";
$this->_finalbody = "";
$this->_header_str = "";
$this->_replyto_flag = FALSE;
$this->_recipients = array();
$this->_headers = array();
$this->_debug_msg = array();
$this->_set_header('User-Agent', $this->useragent);
So at that point $this->_headers['User-Agent'] is using the original 'CodeIgniter' value.
After doing clear() it then does:
Code:
foreach ($config as $key => $val)
{
if (isset($this->$key))
{
$method = 'set_'.$key;
if (method_exists($this, $method))
{
$this->$method($val);
}
else
{
$this->$key = $val;
}
So $this->useragent will get reset at that point, but the
Code:
$this->_set_header('User-Agent', $this->useragent);
occurred already (so $this->_header does not get fixed)
During send() 'X-Mailer' is correctly set:
Code:
function _build_headers()
{
$this->_set_header('X-Sender', $this->clean_email($this->_headers['From']));
$this->_set_header('X-Mailer', $this->useragent);
However later, during _write_headers(), it's using $this->_headers (which is still 'CodeIgniter'):
Code:
function _write_headers()
{
if ($this->protocol == 'mail')
{
$this->_subject = $this->_headers['Subject'];
unset($this->_headers['Subject']);
}
reset($this->_headers);
$this->_header_str = "";
foreach($this->_headers as $key => $val)
{
$val = trim($val);
if ($val != "")
{
$this->_header_str .= $key.": ".$val.$this->newline;