Welcome Guest, Not a member yet? Register   Sign In
Bug with Email Class: Undefined Subject, although it's sent!!!
#11

[eluser]Matt Stein[/eluser]
I'm having the exact same problem. To test, I generated a list of 100+ bogus email addresses at my own domain, and inserted a real address (of my own) at various points within the list.

We discovered this problem by sending out a 3000+ email blast, so I'm hoping my bogus address trick will be sufficient for testing.

I originally followed <a href="http://ellislab.com/forums/viewthread/69935/" target="_blank">this thread</a>, thinking the HTML was the problem. I corrected my emails to make them entire pages including HTML, HEAD, and BODY tags.
#12

[eluser]Thorpe Obazee[/eluser]
[quote author="painting753" date="1246222166"]I was sending to 90 email addresses and getting the errors described, this was when bcc_batch_size was set to 20. I just changed it to 100 and all 90 messages went out fine.

Can someone from CodeIgniter please look into it and help me understand a fix, or let me know if it’ll just have to be logged as a bug and taken care of in the next release?

Regards & Thanks

William


Picture to Painting
Photo to portrait[/quote]

Copied post from: http://ellislab.com/forums/viewthread/87108/#586945
#13

[eluser]Matt Stein[/eluser]
Bump.
#14

[eluser]Unknown[/eluser]
pretty complicated, but awesome support here!
#15

[eluser]Matt Stein[/eluser]
Maybe we're all imagining this thread.
#16

[eluser]Matt Stein[/eluser]
This thread (and the problem) is more than a year old. Is anybody from EllisLab even willing to acknowledge the bug? Is there a solution that appeared somewhere in the meantime?
#17

[eluser]ch5i[/eluser]
Ran into the same issue.

There is a bug in CI_Email class::_write_headers().

This only happens, if
you are using the 'mail' protocol
AND are using the bcc_batch_mode
AND are sending the mail to more than the number of recipients defined in 'bcc_batch_size'

=> this causes _write_headers() be called more than once and in the second round it tries to access the 'Subject' index it has unset in the first round.


To fix this, the following statement:

Code:
if ($this->protocol == 'mail')
{
    $this->_subject = $this->_headers['Subject'];
    unset($this->_headers['Subject']);
}

should be this:

Code:
if ($this->protocol == 'mail')
{
    if (array_key_exists('Subject', $this->_headers))
    {
        $this->_subject = $this->_headers['Subject'];
        unset($this->_headers['Subject']);
    }
}


Here the complete fixed method (in system\libraries\Email.php)

Code:
/**
* Write Headers as a string
*
* @access    private
* @return    void
*/
function _write_headers()
{
    if ($this->protocol == 'mail')
    {
        if (array_key_exists('Subject', $this->_headers))
        {
            $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;
        }
    }

    if ($this->_get_protocol() == 'mail')
    {
        $this->_header_str = rtrim($this->_header_str);
    }
}

Any comments?
#18

[eluser]Unknown[/eluser]
I get this problem to however it's with SMTP:

A PHP Error was encountered
Severity: Notice
Message: Undefined index: From
Filename: libraries/Email.php
Line Number: 921

Severity: Notice
Message: Undefined index: Return-Path
Filename: libraries/Email.php
Line Number: 570

Any suggestions how to solve it? The email is in fact sent. I just get the error anyhow.




Theme © iAndrew 2016 - Forum software by © MyBB