Part of the EllisLab Network
   
1 of 2
1
Bug with Email Class: Undefined Subject, although it’s sent!!!
Posted: 03 August 2008 04:16 PM   [ Ignore ]  
Grad Student
Avatar
Rank
Total Posts:  38
Joined  12-10-2007

Hello. I am getting a strange PHP error when using Email Class.

In the email I am sending I have specified the Subject, after sending email arrives with the subject I’ve specified, yet I am getting this error on the web page when I fire-up the function:

A PHP Error was encountered

Severity
Notice

Message
Undefined indexSubject

Filename
libraries/Email.php

Line Number
930 

Please tell me how can I solve this?

Profile
 
 
Posted: 03 August 2008 04:44 PM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  747
Joined  01-13-2008

Check your controller file have you set the index, of subject in there, it has to be set otherwise the error will keep appearing, even if it is an empty index ’ ‘.

 Signature 

Yonti - I am Currently looking for a business partner, to create the best developer hosting out there. If your interested PM me.

Fluxity Lighting - My other company.


I’m a Proud Supporter and Sponser of Tomorrows Web.

Profile
 
 
Posted: 03 August 2008 05:01 PM   [ Ignore ]   [ # 2 ]  
Grad Student
Avatar
Rank
Total Posts:  38
Joined  12-10-2007

If you mean by index : $this->email->subject(’‘) .. sure!! I just told, I am receiving the email with the subject! so I have it like this: $this->email->subject($msg_subject) ..

Here is the function I am using : http://paste.mycodenow.com/view/27790c69
I am currently discussing that in IRC #codeigniter.

Profile
 
 
Posted: 03 August 2008 05:06 PM   [ Ignore ]   [ # 3 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  747
Joined  01-13-2008

I’m sorry but i don’t no what else it could be, someone else will have a solution though.

 Signature 

Yonti - I am Currently looking for a business partner, to create the best developer hosting out there. If your interested PM me.

Fluxity Lighting - My other company.


I’m a Proud Supporter and Sponser of Tomorrows Web.

Profile
 
 
Posted: 03 August 2008 08:14 PM   [ Ignore ]   [ # 4 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  2774
Joined  07-27-2006
// --------------------------------------------------------------------

    /**
     * Set Email Subject
     *
     * @access    public
     * @param    string
     * @return    void
     */    
    
function subject($subject)
    
{
        
if (strpos($subject"\r") !== FALSE OR strpos($subject"\n") !== FALSE)
        
{
            $subject 
str_replace(array("\r\n""\r""\n"), ''$subject);            
        
}

        
if (strpos($subject"\t"))
        
{
            $subject 
str_replace("\t"' '$subject);
        
}

        $this
->_set_header('Subject'trim($subject));
    

If you don’t ever call subject(), then yes, you will probably see an error from line 930. Odd that the class doesn’t do a check first (I don’t think Subject is a required email header, is it?)

 Signature 

Check out the Template Library
Oh yeah, I tweet, too (regarding CodeIgniter on occassion).

Profile
 
 
Posted: 03 August 2008 08:16 PM   [ Ignore ]   [ # 5 ]  
Sr. Research Associate
Avatar
RankRankRankRankRank
Total Posts:  2774
Joined  07-27-2006

Can you provide code that consistently throws this error in the latest version of CI? I certainly can’t reproduce it.

 Signature 

Check out the Template Library
Oh yeah, I tweet, too (regarding CodeIgniter on occassion).

Profile
 
 
Posted: 01 September 2008 07:58 AM   [ Ignore ]   [ # 6 ]  
Grad Student
Rank
Total Posts:  49
Joined  10-16-2007
Colin Williams - 04 August 2008 12:16 AM

Can you provide code that consistently throws this error in the latest version of CI? I certainly can’t reproduce it.

function invite() {
        $loc 
setlocale(LC_TIME'de_DE.UTF-8''de_DE@euro''de_DE''de''ge');
        
$data = array();
        
$data['subject']='Einladung zur Betriebsratssitzung';

        
// send the mail
        
$this->load->library('email');
        
$config['mailtype''html';
        
$this->email->initialize($config);
        
        
$this->email->from('noreply@brweb.hansenet.com''OpenBR');
        
$this->email->subject($data['subject']);
        
$this->email->Subject($data['subject']);

        
// send personalize message to all members
        
$mems $this->Members_model->getlist('Betriebsrat'); // get all full members
        
        
if ($this->Globals_model->check('agenda_personal_invite')) {
            
// non-personalized
            
$message $this->load->view('email_einladung_allgemein'$datatrue); // get the result instead of displaying it
            
$this->email->message($message);
            
$recipients = array();
            foreach (
$mems as $m{
                $recipients[]
=$m->email;
            
}
            $this
->email->to($recipients);
            
$this->email->send();    // TODO: error handling
        
else {
            
// personalized
            
            // get next agenda/report day
            
$cur $this->Agenda_model->get_current_agenda();
            
$next $this->Agenda_model->get_agenda($cur);

            
$this->load->model('Projects_model');
            foreach (
$mems as $m{
                $data[
'name']=$m->first_name;
                
$data['projects']=$this->Projects_model->getoverview(false$m->member_id$next->day);
                
$message $this->load->view('email_einladung_persoenlich'$datatrue); // get the result instead of displaying it
                
$this->email->message($message);
                
$this->email->to($m->email);
                
$this->email->send(); // TODO: error handling
            
}
            $recipients
='(BR-Mitglieder)';
        
Profile
 
 
Posted: 29 May 2009 09:40 AM   [ Ignore ]   [ # 7 ]  
Summer Student
Avatar
Total Posts:  21
Joined  09-03-2008

Hey Colin,
I am hitting the exact same error on the same line (930). To recreate the problem - try sending to a group of 90+ email addresses - that is when I see it happen. The first 30 or so get sent out fine, with the Correct Subject showing, but then not only does the Subject disappear and errors start getting thrown, but also the HTML body gets garbled.

See these two screengrabs, both the same message, both sent in the same batch.

Good HTML Email received: http://i285.photobucket.com/albums/ll64/jrlooney/Picture3-1.jpg

Garbled HTML Email received: http://i285.photobucket.com/albums/ll64/jrlooney/Picture4-1.jpg

“Error” output by CI: http://i285.photobucket.com/albums/ll64/jrlooney/Picture5.jpg

 Signature 

We are the music makers, and we are the dreamers of dreams.
~Willy Wonka

Profile
 
 
Posted: 29 May 2009 09:57 AM   [ Ignore ]   [ # 8 ]  
Summer Student
Avatar
Total Posts:  21
Joined  09-03-2008

NOTE - if i change the protocol setting in the config from mail to sendmail, the “Subject” problem goes away, however the HTML is still getting garbled

Can you think of a way I can troubleshoot this w/o sending out the messages, and somehow seeing the values CI is trying to use for each block of 20 messages before it sends them to sendmail (any way to see if it’s a CI problem or a sendmail problem)?

 Signature 

We are the music makers, and we are the dreamers of dreams.
~Willy Wonka

Profile
 
 
Posted: 29 May 2009 04:21 PM   [ Ignore ]   [ # 9 ]  
Summer Student
Avatar
Total Posts:  21
Joined  09-03-2008

Just got another clue.

It appears to be related to
bcc_batch_mode
&
bcc_batch_size

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?

 Signature 

We are the music makers, and we are the dreamers of dreams.
~Willy Wonka

Profile
 
 
Posted: 22 June 2009 12:52 AM   [ Ignore ]   [ # 10 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  137
Joined  09-30-2007

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 this thread, thinking the HTML was the problem. I corrected my emails to make them entire pages including HTML, HEAD, and BODY tags.

 Signature 

Working Concept

Profile
 
 
Posted: 28 June 2009 09:31 PM   [ Ignore ]   [ # 11 ]  
Lab Technician
RankRankRankRank
Total Posts:  1264
Joined  04-19-2008
painting753 - 28 June 2009 03:49 PM

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

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

 Signature 

PinoyTech - Web Development Blog

Profile
 
 
Posted: 03 August 2009 04:35 PM   [ Ignore ]   [ # 12 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  137
Joined  09-30-2007

Bump.

 Signature 

Working Concept

Profile
 
 
Posted: 10 August 2009 11:51 AM   [ Ignore ]   [ # 13 ]  
Summer Student
Total Posts:  2
Joined  08-10-2009

pretty complicated, but awesome support here!

Profile
 
 
Posted: 11 August 2009 12:05 AM   [ Ignore ]   [ # 14 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  137
Joined  09-30-2007

Maybe we’re all imagining this thread.

 Signature 

Working Concept

Profile
 
 
Posted: 25 September 2009 05:19 PM   [ Ignore ]   [ # 15 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  137
Joined  09-30-2007

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?

 Signature 

Working Concept

Profile
 
 
   
1 of 2
1