wamp で pear のメール送信機能を使用する際に問題が発生しています。このリンク ( http://pear.php.net/manual/en/installation.checking.php ) の手順を実行して、pear が正しくインストールされているかどうかを確認しました。
<?php
require_once 'System.php';
var_dump(class_exists('System', false));
?>
上記のコードは を返しますbool(true)
。だから私は私の道が正しく設定されていると仮定しています。しかし、以下のコードではエラーが発生します。
<?php
include 'Mail.php';
include 'Mail/mime.php' ;
$text = 'Text version of email';
$html = '<html><body>HTML version of email</body></html>';
$file = 'test.xls';
$crlf = "\n";
$hdrs = array(
'From' => 'myemail@gmail.com',
'Subject' => 'Test mime message'
);
$mime = new Mail_mime(array('eol' => $crlf));
$mime->setTXTBody($text);
$mime->setHTMLBody($html);
$mime->addAttachment($file, 'text/plain');
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
$mail =& Mail::factory('mail');
$mail->send('myemail2@gmail.com', $hdrs, $body);
?>
エラーは次の行にあります: $mail =& Mail::factory('mail');
。Fatal error: Class 'Mail' not found
また、次のコマンドで pear Mail をインストールしました。pear install Mail Mail_mime
助けていただければ幸いです。
ありがとう、