Re: Mail.php - newbie question

From: Date: Thu, 23 Sep 2004 14:11:56 +0000
Subject: Re: Mail.php - newbie question
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-14615@lists.php.net to get a copy of this message
Oscar Karlsson wrote:
Hi there! I tried this simple mail example script and got the following error: Fatal error: Cannot redeclare class mail in /customers/lzr.se/lzr.se/httpd.www/includes/Mail.php on line 33 Anyone have any suggestions? Regards <html> <title>test</title> <body> <?php ini_set("include_path", '/customers/lzr.se/lzr.se/httpd.www/includes/' . PATH_SEPARATOR . ini_get("include_path")); require_once 'PEAR.php'; require_once 'Mail.php'; include('Mail.php');
Only require_once Mail.php. Your problem is that you are including it twice, which causes that error message. Remove the include line and you should be set. Klaus
define('MYCLASS_ERROR_CODE', 1); PEAR::setErrorHandling(PEAR_ERROR_TRIGGER, E_USER_WARNING); $recipients = 'lzr@home.se';
$headers['From']    = 'lzr@home.se';
$headers['To']      = 'lzr@home.se';
$headers['Subject'] = 'Test2 message'; $body = 'Test message'; $params['sendmail_path'] = '/usr/sbin/sendmail'; // Create the mail object using the Mail::factory method $mail_object =& Mail::factory('sendmail', $params); $mail_object->send($recipients, $headers, $body); ?> </body> </html>


« previous php.pear.general (#14615) next »