0

PEAR Mail と Mail_Mime の最新バージョンをインストールしました。このページの次のテスト メールを使用して、テスト メッセージを送信しようとしています

<?
        include('/home/****/php/Mail.php');
        include('/home/****/php/Mail/mime.php');

        // Constructing the email
        $sender = "**** <info@****.com>";                              // Your name and email address
        $recipient = "**** <****@gmail.com>";                           // The Recipients name and email address
        $subject = "Test Email";                                            // Subject for the email
        $text = 'This is a text message.';                                  // Text version of the email
        $html = '<html><body><p>This is a html message</p></body></html>';  // HTML version of the email
        $crlf = "\n";
        $headers = array(
                        'From'          => $sender,
                        'Return-Path'   => $sender,
                        'Subject'       => $subject
                        );

        // Creating the Mime message
        $mime = new Mail_mime($crlf);

        // Setting the body of the email
        $mime->setTXTBody($text);
        $mime->setHTMLBody($html);

        $body = $mime->get();
        $headers = $mime->headers($headers);

        // Sending the email
        $mail =& Mail::factory('mail');
        $mail->send($recipient, $headers, $body);
?>

そして、メッセージは送信されていません。エラーログが表示されたことを確認しています:

[2012 年 7 月 24 日 02:14:50] PHP 致命的なエラー: /home/ * */php/Mail/mime.php の 1330 行目の未定義メソッド Mail_mimePart::encodeHeader() の呼び出し

このエラーメッセージが何に関連しているか、またそれに対して何ができるかを知っている人はいますか? mime.php の 1330 行目は、この関数の 4 行目です。

function encodeHeader($name, $value, $charset, $encoding)
    {
        $mime_part = new Mail_mimePart;
        return $mime_part->encodeHeader(
            $name, $value, $charset, $encoding, $this->_build_params['eol']
        );
    }
4

1 に答える 1

1
include_once("Mail/mime.php");

インクルードする必要があります。

于 2012-07-24T23:49:40.447 に答える