alancgmty2099 Posted September 8, 2009 Share Posted September 8, 2009 Hello all I installed the mail and net_smtp PEAR modules but I get the following error message when I type http://localhost/mailer1.php Fatal error: Cannot redeclare class Mail_smtp in C:\Program Files\xampplite\xampplite\php\PEAR\Net\smtp.php on line 348 Does anybody know what ths problem is with this? I would appreciate any help...Thank you Link to comment https://forums.phpfreaks.com/topic/173550-problems-with-sending-an-email-in-php-using-the-mail-module/ Share on other sites More sharing options...
ignace Posted September 8, 2009 Share Posted September 8, 2009 You included (or required) the class twice in your code. Similar to: include('Class.php'); include('Class.php');//Cannot redeclare class Class .. Link to comment https://forums.phpfreaks.com/topic/173550-problems-with-sending-an-email-in-php-using-the-mail-module/#findComment-914830 Share on other sites More sharing options...
alancgmty2099 Posted September 8, 2009 Author Share Posted September 8, 2009 Thanks igance for your reply. Here's my code: <?php require_once 'Mail.php'; /* mail setup recipients, subject etc */ $recipients = "[email protected]"; $headers["From"] = "[email protected]"; $headers["To"] = "[email protected]"; $headers["Subject"] = "User feedback"; $mailmsg = "Hello, This is a test."; /* SMTP server name, port, user/passwd */ $smtpinfo["host"] = ""; $smtpinfo["port"] = "25"; $smtpinfo["auth"] = true; $smtpinfo["username"] = ""; $smtpinfo["password"] = ""; /* Create the mail object using the Mail::factory method */ $mail_object =& Mail::factory("smtp", $smtpinfo); /* Ok send mail */ $mail_object->send($recipients, $headers, $mailmsg); In the file smtp.php, the class Mail_smtp extends the class Mail, however, I don't see this class redeclared Link to comment https://forums.phpfreaks.com/topic/173550-problems-with-sending-an-email-in-php-using-the-mail-module/#findComment-914953 Share on other sites More sharing options...
ignace Posted September 9, 2009 Share Posted September 9, 2009 In the file smtp.php, the class Mail_smtp extends the class Mail, however, I don't see this class redeclared Is there a require_once or something similar above the class Mail_Smtp definition? Link to comment https://forums.phpfreaks.com/topic/173550-problems-with-sending-an-email-in-php-using-the-mail-module/#findComment-915321 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.