Index: trunk/kernel/include/emailmessage.php =================================================================== diff -u -r271 -r294 --- trunk/kernel/include/emailmessage.php (.../emailmessage.php) (revision 271) +++ trunk/kernel/include/emailmessage.php (.../emailmessage.php) (revision 294) @@ -656,14 +656,15 @@ function DeliverMail($To,$From,$Subject,$Msg,$headers, $ForceSend=0) { global $MessagesSent,$objConfig; - + if(($this->MessagesSent >$this->MessagesAtOnce) && !$ForceSend) { $this->EnqueueMail($To,$From,$Subject,$Msg,$headers); return TRUE; } else { + $this->MessagesSent++; /* ensure headers are using \r\n instead of \n */ //$headers = str_replace("\r\n","\n",$headers); @@ -685,7 +686,7 @@ } $headers = "Subject: ".trim($Subject)."\r\n".$headers; - + $send_params['recipients'] = array($To); // The recipients (can be multiple) $send_params['headers'] = explode("\r\n",$headers); $send_params['from'] = $From; // This is used as in the MAIL FROM: cmd @@ -717,13 +718,16 @@ else $SmtpServer->debug = 0; $connected = $SmtpServer->connect(); + + + if($connected) { if($this->LogLevel>1) { $this->WriteToMailLog("Connected to ".$params['host']); } - $res = $SmtpServer->send($send_params); + $res = $SmtpServer->send($send_params); } $SmtpServer->disconnect(); if($this->LogLevel>1)