Welcome Guest, Not a member yet? Register   Sign In
problem with codeigniter html mail
#1

[eluser]LoRdCoStE[/eluser]
I have succesfully sent 3000 text mail with codeigniter mail class. (using BCC)
I have also sent about 5 html mail with codeigniter.

But something strange happen when I try to send an high numbers of html mail (3000).

Here the code:
config/email.php:
Code:
$config['bcc_batch_mode'] = TRUE;
$config['bcc_batch_size'] = 100;
$config['protocol'] = 'mail';
$config['wordwrap'] = FALSE;

$config['mailtype'] = 'html';

Code:
function send() {
        
        $this->load->model('mail_model', 'mail');
        
        $mails = array();
        
        foreach($this->mail->getMail() as $m) {
              if($this->_isValidMail($m['mail']))
             $mails[] = trim($m['mail']);
        }
        
        $this->load->library('email');
        
        $this->email->from('[email protected]', 'My mail');
        
        $this->email->to('');
        
        $this->email->bcc($mails);
        
        $this->email->subject('subject');
        
        $this->email->set_alt_message("Se non riesci a visualizzare questa mail visita:\n
        http://www.octima.it/newsletter/01.html");
        
        $this->email->message(file_get_contents('http://www.octima.it/newsletter/01.html'));
        
        if ( ! $this->email->send())
        {
            echo 'Error!!!<br />';
        }
        
        # debugging
        echo $this->email->print_debugger();

    }

The mails are sent but are unreadable full of strange code:
Code:
...
=3D3D3D3D3D3D3D3D3D3D =3D3D3D3D3D3D3D3D3D3D3D =3D3D3D3D3D3D3D3D3D3D3D3D =3D3D3D3D3D3D3D3D3D3D3D3D3D =3D3D3D3D3D3D3D3D3D3D3D3D3D3D =3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D =3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D =3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D =3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D =3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D =3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D =3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D =3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D =3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D3D Modena Fiere. Un servizio creato per i professionisti=3D3D3D3D3D3D3D3D3D3D= 3D=3D 3D=3D3D 3D=3D3D3D 3D=3D3D3D3D 3D=3D3D3D3D3D 3D=3D3D3D3D3D3D 3D=3D3D3D3D3D3D3D 3D=3D3D3D3D3D3D3D3D 3D=3D3D3D3D3D3D3D3D3D 3D=3D3D3D3D3D3D3D3D3D3D 3D=3D3D3D3D3D3D3D3D3D3D3D 3D=3D3D3D3D3D3D3D3D3D3D3D3D 3D=3D3D3D3D3D3D3D3D3D3D3D3D3D
...
#2

[eluser]InsiteFX[/eluser]
This is usally caused by your email client, a way around this is to
change the emial clients mime type for encoding to NONE.

InsiteFX
#3

[eluser]LoRdCoStE[/eluser]
mm strange, because if I use the same code but instead of:
Code:
$mails = array();
        
        foreach($this->mail->getMail() as $m) {
              if($this->_isValidMail($m['mail']))
             $mails[] = trim($m['mail']);
        }

use:
Code:
$mails = array();
$mails[0] = '[email protected]';

I recive the email and is readable, the client is the same because my address is also stored in the database so is returned by $this->mail->getMail(), but in that case the mail is not readable :/
#4

[eluser]InsiteFX[/eluser]
did you try to echo $mail to see what it contains?

InsiteFX
#5

[eluser]LoRdCoStE[/eluser]
Do you mean the var that contain the message?
Yes, if I print the message file_get_contents('http://www.octima.it/newsletter/01.html') i can see the "normal" html code of the page.

I have also tried to send the html message to the 3000 mails 2 times and both time there was the same error.

Still no error if i send it to just 1-5 adrress.

The big problem is that I can't continue testing because everytime the 3000 addressed will receive the messed up mail :/

What can I do?
#6

[eluser]LoRdCoStE[/eluser]
up Sad
#7

[eluser]LoRdCoStE[/eluser]
up
#8

[eluser]Clooner[/eluser]
Seems to be a reoccuring bug in the mailing class what was your solution? Seems to be only when happening when using the batch mode. The newlines and headers get messed up with the second batch. Btw you can easily test it when sending 5 mails just set the batch size to 1. No luck in finding an easy solution though!
#9

[eluser]LoRdCoStE[/eluser]
No solution found yet.
For now I'm using phpmailer as plugin, but hope to find a solution one day cause it will be nice to use the batch mode of codeigniter.
#10

[eluser]Clooner[/eluser]
I actually just made a fix for it. I just posted it on: http://ellislab.com/forums/viewthread/156323/.




Theme © iAndrew 2016 - Forum software by © MyBB