Welcome Guest, Not a member yet? Register   Sign In
Email Class - does not send when using an array for the TO
#1

[eluser]corkscrew[/eluser]
Attempting to send emails using the CI Email Class. Sends emails as long as I use a comma-delimited list of email addresses. If I use an array (from the db) it displays a message saying that the email was sent - but does not actually send an email. That is - no messages are received. very confusing - any ideas would be appreciated.

Code:
$this->load->library('email');
        $addresses = $this->MEmails->emails();

        $config['protocol'] = 'sendmail';
        $config['mailpath'] = '/usr/sbin/sendmail';
        $this->email->initialize($config);

        $this->email->from('[email protected]','Tom');
        $this->email->to($addresses);
        $this->email->subject('Maintenance');
        $this->email->message('Test configuration');

        $this->email->send();

        if (! $this->email->send()) {
            echo "Email did not Send";
            echo $this->email->print_debugger();

        }
#2

[eluser]Derek Allard[/eluser]
The docs say
Quote:Sets the email address(s) of the recipient(s). Can be a single email, a comma-delimited list or an array:

But it wouldn't be a bad idea to support arrays in there also if you wanted to drop some code into feature requests. If you have an array and need a comma-delimited list, take a look at implode()




Theme © iAndrew 2016 - Forum software by © MyBB