php - $this->email->send() return false still email get send
I am sending notification email using code igniter email library. Email sending is working properly but sometime only.
I am using$this->email->send()
to check that email is send or not. Like:
if($this->email->send())
{
//Success
} else {
// faile
print_r ( $this->email->print_debugger ( array ('headers','subject') ));
}
Problem:
It sounds unreal but I have tested it many time before asking here.
When I execute the code then in my system log it shows that email isUnable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
but When i check the email account then it has that email which my system log say failed. In short$this->email->send()
is not working for me.
So can anyone suggest any other alternative solution for this problem.
I have also tried to debug it and it shows that it will came to ease and print the debug detail but while in this process email is get send.
In the debug process$this->email->send()
returnFALSE
but still email get send.
any suggestion regarding this will be appreciated.
Answer
Solution:
if sending email in a loop try
$this->email->clear();
before defining email variables
here is an example