Panowie czy jest ktos w stanie wytlumaczyc mi dlaczego kiedy probuje wyslac np 20 maili w petli to w pewnym momencie serwer zglasza mi blad 502 bad gateway ngix ?
private function _make_winner($id)
{
$this->load->helper('security');
$user = $this->cms->get_entry($id);
$key = do_hash
($user->email.$user->datetime.$user->id.time().uniqid()); //$_POST['key'] = $key;
if ($this->_send_email($user->email, $key))
{
//$this->entries->addKey($id);
return $key;
}
else
{
return false;
}
}
private function _send_email($email, $key)
{
$this->load->library('PHPMailer');
$this->load->library('SMTP');
$mail = new PHPMailer;
$mail->isSMTP();
$mail->isHTML(true);
$mail->Host = 'poczta.o2.pl';
$mail->SMTPAuth = true;
$mail->Username = '';
$mail->Password = '';
$mail->SMTPSecure = 'ssl';
$mail->Port = 465;
$mail->CharSet = 'UTF-8';
$mail->From = '';
$mail->FromName = 'Tyskie';
$mail->addAddress($email);
$mail->Subject = '';
$mail->Body = "$key";
if (!$mail->send()) {
return false;
}
return true;
}
public function createAutoWinKeyEmail(){
if($this->input->post()){
$string = explode("\n", $this->input->post('autoWinKeyEmail'));
foreach ($string as $row) {
$winned_entries = $this->cms->get_winned_entries($row);
$key = $this->_make_winner($row);
if($key){
$win_entry = $this->cms->win_entry($row, $key);
echo $row . " Utworzono klucz oraz wyslano maila<br>"; }else{
echo $row . " <span style='color:red;'>Nie utworzono klucza oraz nie wyslano maila</span><br>";
}
}
}else{
redirect('backend');
}
}