PHP de Messagerie SMTP Personnalisée de Retour de la fonction d'ERREUR fputs envoyer des octets échoué errno=32 Broken pipe

J'ai écrit la prochaine personnalisé fonction PHP pour envoyer un mail via un SERVEUR de MESSAGERIE SMTP.

function send($format = 'text'){
$smtpServer  = 'mail.mymailserver.com.mx';
$port        = '25';
$timeout     = '60';
$username    = 'myuser';
$password    = 'mypassword';
$localhost   = 'www.mydomain.com.mx';
$newLine     = "\r\n";
$smtpConnect = fsockopen( $smtpServer, $port, $errno, $errstr, $timeout );
fputs( $smtpConnect,'AUTH LOGIN'.$newLine );
fputs( $smtpConnect, base64_encode( $username )  . $newLine    );
fputs( $smtpConnect, base64_encode( $password )  . $newLine    );
fputs( $smtpConnect, 'HELO '       . $localhost  . $newLine    );
fputs( $smtpConnect, 'MAIL FROM: ' . $this->from . $newLine    );
fputs( $smtpConnect, 'RCPT TO: '   . $this->to   . $newLine    );
if( !empty( $this->cc ) ){
fputs( $smtpConnect, 'RCPT TO: '   . $this->cc   . $newLine    );
}
if( !empty( $this->bcc ) ){
fputs( $smtpConnect, 'RCPT TO: '   . $this->bcc  . $newLine    );
}
fputs( $smtpConnect, 'DATA'        . $newLine                  );
fflush( $smtpConnect );
$raw  = "";
$raw  = @fread( $smtpConnect, 255 ) . "@";
$raw .= @fread( $smtpConnect, 255 );
fputs( $smtpConnect, 'To:     '  . $this->to . $newLine        );
fputs( $smtpConnect, 'From:   <' . $this->from .'>' . $newLine );
fputs( $smtpConnect, 'Subject:'  . $this->subject . $newLine   );
$format = 'html';
if( $format == 'text' ){
$headers  = "Content-Type: text/plain; charset=\"iso-8859-1\"" . "\r\n";
$headers .= "Content-Transfer-Encoding: 7bit" . "\r\n";
$message  = $this->bodyText();
fputs( $smtpConnect, $headers   . $newLine  . $newLine       );
fputs( $smtpConnect, $message   . $newLine  . '.' . $newLine );
}else{
$random_hash = md5(date('r', time()));
$headers  = "Content-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\"\r\n";
$headers .= "--PHP-alt-" . $random_hash . "\r\n";
$headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"" . "\r\n";
$headers .= "Content-Transfer-Encoding: 7bit" . "\r\n";
$message  = $this->bodyText();
fputs( $smtpConnect, $headers . $newLine );
fputs( $smtpConnect, $message . $newLine );
$headers  = "--PHP-alt-" . $random_hash . "\r\n";
$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"" . "\r\n";
$headers .= "Content-Transfer-Encoding: 7bit" . "\r\n";
$message  = $this->bodyHtml();
fputs( $smtpConnect, $headers  . $newLine );
fputs( $smtpConnect, $message  . $newLine );
$headers  = "--PHP-alt-" . $random_hash . "--\r\n";
fputs( $smtpConnect, $headers . '.' . $newLine  );
}
fputs( $smtpConnect,'QUIT'      . $newLine );
return true;
}

La fonction fonctionne très bien, mais dans les derniers jours, je recived les nexts erreurs php:

Avis: fputs() [function.fputs]: envoyer de 8192 octets a échoué avec errno=32 Broken pipe /cakeapp/trunk/app/controllers/components/email.php sur la ligne 165

Avis: fputs() [function.fputs]: envoyer de 49 octets a échoué avec errno=32 Broken pipe /cakeapp/trunk/app/controllers/components/email.php sur la ligne 169

Avis: fputs() [function.fputs]: envoyer de 6 octets a échoué avec errno=32 Broken pipe /cakeapp/trunk/app/controllers/components/email.php sur la ligne 182

J'étais à la recherche dans Google pour des suggestions, mais les infos que j'ai trouvé, a parlé d'un problème lié à la Connexion des Sorties de Temps !

Quelqu'un peut-il suggérer un moyen de corriger ce problème ?

essayez cette classe: pastebin.com/e1RiPj6P je l'utilise au sein de chaque projet.
Je suis en essais avec la valeur de la varible $timeout, je vais l'augmenter de 60 secondes à 90. Semble que ce changement de résoudre le problème, je vais attendre plus de temps avant de fermer ce post : )
Ce problème est également visible à l'aide de Zend_Mail composant et non pas à tous, unique à ce courrier personnalisé en fonction.

OriginalL'auteur Edwin Sandoval | 2010-12-02