Это не решило проблему.

исал следующую пользовательскую функцию PHP для отправки почты через SMTP MAIL SERVER.

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;

}

Функция работала очень хорошо, но в последние дни я получил ошибки php nexts:

Примечание: fputs () [function.fputs]: отправка 8192 байт завершилась неудачно с errno = 32 Сломанный канал в /cakeapp/trunk/app/controllers/components/email.php в строке 165

Примечание: fputs () [function.fputs]: отправка 49 байт завершилась неудачно с errno = 32 Сломанный канал в /cakeapp/trunk/app/controllers/components/email.php в строке 169

Примечание: fputs () [function.fputs]: отправка 6 байтов завершилась неудачно с errno = 32 Сломанный канал в /cakeapp/trunk/app/controllers/components/email.php в строке 182

Я искал в Google некоторые предложения, но информация, которую я нашел, говорила о проблеме, связанной с Тайм-аутом соединения!

Кто-нибудь может предложить способ исправить эту проблему?

Ответы на вопрос(2)

Ваш ответ на вопрос