Welcome Guest, Not a member yet? Register   Sign In
mailing list problem
#1

[eluser]mohamed eid[/eluser]
hello i try to make mailing list but it dosent send to the mail this is my code
Code:
function sendmail()
    {
        if($this->input->post('submit'))
        {
           $this->load->library('email');
           $config['mailtype'] = 'html';
           $this->email->initialize($config);
            //this is the model to get email
           $emails=$this->useremail_model->getall_email();
           foreach($emails as $email)
           {
                 $this->email->clear();
                 $this->email->to($email->useremail);
                 $usubject=$this->input->post('subject');
                 $this->email->from('[email protected]');
                 $data['usubject']=$this->input->post('subject');
                $data['umessage']=$this->input->post('content');
                $msg=$this->load->view('admin/sended',$data,true);
                $this->email->message($msg);
               echo $email->useremail;
           }  
             if($this->email->send())
             {
               echo 'Email sent.';
             }
             else
             {
               show_error($this->email->print_debugger());
             }
           }

        else

        {
              $data['menu'] = $this->load->view('admin/menu', '', true);
              $this->load->view('admin/sendmail',$data);

        }

    }


can any one help me to know where is the error ??
#2

[eluser]InsiteFX[/eluser]
Your not setting any of the email protocols!
Code:
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset']  = 'iso-8859-1';
$config['wordwrap'] = TRUE;

Some of these need to be setup in your php.ini file.
#3

[eluser]mohamed eid[/eluser]
no this is not the problem
if i used one email to send it wok correctly
but when i called the mail from database it not sended
the problem is from this part
Code:
$emails=$this->useremail_model->getall_email();
           foreach($emails as $email)
           {
                 $this->email->clear();
                 $this->email->to($email->useremail);
                 $usubject=$this->input->post('subject');
                 $this->email->from('[email protected]');
                 $data['usubject']=$this->input->post('subject');
                $data['umessage']=$this->input->post('content');
                $msg=$this->load->view('admin/sended',$data,true);
                $this->email->message($msg);
               echo $email->useremail;
           }

the problem in fetch the emails from database an buting them in
Code:
$this->email->to('$email->usermail')
#4

[eluser]InsiteFX[/eluser]
Now tell me whats wrong with this?
Code:
foreach($emails as $email)
{
    $this->email->clear();
    $this->email->to($email->useremail);
    $usubject=$this->input->post('subject');
    $this->email->from('[email protected]');
    $data['usubject']=$this->input->post('subject');
    $data['umessage']=$this->input->post('content');
    $msg=$this->load->view('admin/sended',$data,true);
    $this->email->message($msg);
    echo $email->useremail;
}  

if($this->email->send())
{
    echo 'Email sent.';
}
else
{
    show_error($this->email->print_debugger());
}

That's your problem it's basic php debugging!

And if you cannot figure it out! Move your if statement into your foreach...
#5

[eluser]mohamed eid[/eluser]
it is not give me any php error
it give m message email sent

but when i checked the emils i didnt find any mail arrived to my email
#6

[eluser]mohamed eid[/eluser]
i have to email in the database
[email protected]
and [email protected]

the message sended to [email protected] and not sended to [email protected]
#7

[eluser]mohamed eid[/eluser]
when i added new email to database
the message sended to the third emil only and not sended to other emails
what is the problem now ??




Theme © iAndrew 2016 - Forum software by © MyBB