peterr Posted May 10, 2004 Share Posted May 10, 2004 Hi, If, for example, your domain is toniwong.com, then host is ........... $params["host"] = "localhost.toniwong.com"; Peter Link to comment Share on other sites More sharing options...
Guest Posted May 10, 2004 Share Posted May 10, 2004 But is it important?! Because I'm just testing on my own server, nothing domain name! Link to comment Share on other sites More sharing options...
peterr Posted May 10, 2004 Share Posted May 10, 2004 Toni, If it is just local (your own server), then 'localhost' _should_ do, the best way to see is to try it. :) Peter Link to comment Share on other sites More sharing options...
Guest Posted May 10, 2004 Share Posted May 10, 2004 Hi Peterr I tried it. It returns into admin page but it is http://localhost/catalog/admin/forbiden.php forbiden Link to comment Share on other sites More sharing options...
peterr Posted May 10, 2004 Share Posted May 10, 2004 Hi, Do you have the PHP errors going to a file called 'error_log', or possibly another file ? Any error messages that you can supply, other than the "403" (forbidden), sounds like a path permissions problem ? Peter Link to comment Share on other sites More sharing options...
Guest Posted May 10, 2004 Share Posted May 10, 2004 Do you have the PHP errors going to a file called 'error_log', or possibly another file ? Any error messages that you can supply, other than the "403" (forbidden), sounds like a path permissions problem ? No any error in this page, but it auto direct to forbidden.php file Link to comment Share on other sites More sharing options...
peterr Posted May 10, 2004 Share Posted May 10, 2004 Hi, Well there is no such file supplied with a 'stock/standard' osCommerce, so you must have this in your .htaccess file ErrorDocument 404 http://localhost/catalog/admin/forbiden.php ....... or similar. :) You may get better answers to this problem on a PHP forum, because it is not osCommerce that is the problem. There are so many factors to compound the problem, because you are not running osCommerce from a domain/server, it sounds like it is being run from your home computer. You may be running Apache under Windows, or running a Linux box, or running PHPdev, or ....,etc,etc. I always get very good replies/answers to problems like this at the Sitepoint forums, just register and post your questions at: http://www.sitepoint.com/forums/forumdisplay.php?f=34 there are many PHP gurus there, who no doubt have done what you are tring to do. Peter edit:try a google on string "mail::factory authenticate", there are some interesting posts there. Link to comment Share on other sites More sharing options...
peterr Posted May 10, 2004 Share Posted May 10, 2004 Toni, Interesting post at http://www.php-editors.com/pear_manual/ind....mail.send.html You may need to tell Mail::factory where your sendmail is, like: $params['sendmail_path'] = '/usr/lib/sendmail'; Peter Link to comment Share on other sites More sharing options...
Guest Posted May 10, 2004 Share Posted May 10, 2004 You may need to tell Mail::factory where your sendmail is, like: CODE $params['sendmail_path'] = '/usr/lib/sendmail'; Is it used Sendmail function ?! Link to comment Share on other sites More sharing options...
peterr Posted May 10, 2004 Share Posted May 10, 2004 Hi, See http://au.php.net/mail ... all the information is there. Peter Link to comment Share on other sites More sharing options...
Guest Posted May 10, 2004 Share Posted May 10, 2004 Hi Peterr, I tried to use this code save as sendmail.php <?phpinclude('Mail.php'); $recipients = 'Toni Wong'; $headers['From'] = '[email protected]'; $headers['To'] = '[email protected]'; $headers['Subject'] = 'Test message of sendmail'; $params["host"] = "smtp.on-nets.com"; $params["port"] = "25"; $params["auth"] = true; $params["username"] = "[email protected]"; $params["password"] = "xxxx"; $body = 'Test message'; $params['sendmail_path'] = '/usr/lib/sendmail'; // Create the mail object using the Mail::factory method $mail_object =& Mail::factory('sendmail', $params); $mail_object->send($recipients, $headers, $body); ?> I try to load this page, it hasn't any response. Just reply the blank page! And no email received. what's happened? Link to comment Share on other sites More sharing options...
Guest Posted May 10, 2004 Share Posted May 10, 2004 Oh...I got it !!! :lol: I can send the email now. Thx~ Link to comment Share on other sites More sharing options...
Guest Posted May 10, 2004 Share Posted May 10, 2004 Hi Peter, I still have the problem. I add this code in /admin/includes/classes/email.php include("Mail.php"); $recipients = "$to"; $headers["From"] = $from; $headers["To"] = $to; $headers["Subject"] = $subject; $params["host"] = "smtp.on-nets.com"; $params["port"] = "25"; $params["auth"] = true; $params["username"] = "[email protected]"; $params["password"] = "xxxx"; // Create the mail object using the Mail::factory method $mail_object =& Mail::factory("smtp", $params); $mail_object->send($recipients, $headers, $body); Inserted before if (EMAIL_TRANSPORT == 'smtp') { return mail($to_addr, $subject, $this->output, 'From: ' . $from . $this->lf . 'To: ' . $to . $this->lf . implode($this->lf, $this->headers) . $this->lf . implode($this->lf, $xtra_headers)); } else { return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode($this->lf, $this->headers).$this->lf.implode($this->lf, $xtra_headers)); } Now, it can send the email to my email address. But it hasn't content. Why?! What is missing?! Thanks~ Link to comment Share on other sites More sharing options...
Guest Posted May 10, 2004 Share Posted May 10, 2004 $params["host"] = "smtp.on-nets.com";$params["port"] = "25"; $params["auth"] = true; $params["username"] = "[email protected]"; $params["password"] = "xxxx"; $body = $this->output; Oh....I know that la.... :D the body is $ this->output hahahahaha ^_^ Link to comment Share on other sites More sharing options...
peterr Posted May 11, 2004 Share Posted May 11, 2004 Hi Toni, Good that you have it working. You are now a PHP guru. :D Peter Link to comment Share on other sites More sharing options...
razor7 Posted June 27, 2005 Share Posted June 27, 2005 Hello...installed the SMTP contribution using Mail.php and i get this Fatal error: Cannot redeclare tep_db_connect() (previously declared in C:\webspace\maximiliano\producto\productoscristianos.com.ar\www\carrito\admin\includes\functions\database.php:13) in C:\webspace\maximiliano\producto\productoscristianos.com.ar\www\carrito\admin\includes\functions\database.php on line 25 Changed config of both email.php files to $headers["From"] = $from; $headers["To"] = $to_addr; $headers["Subject"] = $subject; $headers["Bcc"] = "[email protected]"; $params["host"] = "mail.productoscristianos.com.ar"; $params["port"] = "25"; $params["auth"] = true; $params["username"] = "[email protected]"; $params["password"] = "xxxxxx"; I used the test.php by my own with same config and is working great, but oscommerce refuses to work, jeje Any HElp? Link to comment Share on other sites More sharing options...
♥Vger Posted June 27, 2005 Share Posted June 27, 2005 Take a look in the Knowledge Base by following the link below and you may find the answer to your problem. http://www.oscommerce.info/kb/Catalog_Guid...on_Problems/198 Vger Link to comment Share on other sites More sharing options...
Guest Posted June 27, 2005 Share Posted June 27, 2005 Hello...installed the SMTP contribution using Mail.php and i get this Fatal error: Cannot redeclare tep_db_connect() (previously declared in C:\webspace\maximiliano\producto\productoscristianos.com.ar\www\carrito\admin\includes\functions\database.php:13) in C:\webspace\maximiliano\producto\productoscristianos.com.ar\www\carrito\admin\includes\functions\database.php on line 25 Changed config of both email.php files to $headers["From"] = $from; $headers["To"] = $to_addr; $headers["Subject"] = $subject; $headers["Bcc"] = "[email protected]"; $params["host"] = "mail.productoscristianos.com.ar"; $params["port"] = "25"; $params["auth"] = true; $params["username"] = "[email protected]"; $params["password"] = "xxxxxx"; I used the test.php by my own with same config and is working great, but oscommerce refuses to work, jeje Any HElp? <{POST_SNAPBACK}> Well the error is telling you that the function tep_db_connect is being declared more than once. So obviously somewhere in your code it is calling require(database.php) more than once in your code somewhere. Now it could be in the same file or it could be in another file that your current file calls with require(); Go through your code from the top, if you see a require(database.php) somewhere comment it out with // at the start of the line. Test if things work after that. If not then look at all the require() statements, some of the files are trying to call the database.php more than once. (this assumes you did not change the database.php file in any way) Link to comment Share on other sites More sharing options...
razor7 Posted June 28, 2005 Share Posted June 28, 2005 OK i solved the problem but the send mail dialog in Tools admin box throws me this... Fatal error: Class 'Mail' not found in C:\webspace\maximiliano\producto\productoscristianos.com.ar\www\carrito\admin\includes\classes\email.php on line 515 This is the code require_once 'Mail.php'; $user_contact = '[email protected]'; $headers["From"] = $from; $headers["To"] = $to_addr; $headers["Subject"] = $subject; $headers["Bcc"] = "[email protected]"; $params["host"] = "mail.productoscristianos.com.ar"; $params["port"] = "25"; $params["auth"] = true; $params["username"] = "[email protected]"; $params["password"] = "favalli"; // Create the mail object using the Mail::factory method $mail_object =& Mail::factory("smtp", $params); return $mail_object->send("$to_addr, [email protected]", $headers, $this->output); I have my Test.php in the same folder and it delivers OK and the frontend mails are delivered ok too... Any help? Thanks a lot for your help!!! PS: i my host is a NT Server and uses PHP5 :( Link to comment Share on other sites More sharing options...
razor7 Posted June 29, 2005 Share Posted June 29, 2005 Hey guys, this error occurs when i try to send an enail from the admnin area Fatal error: Class 'Mail' not found in C:\webspace\maximiliano\producto\productoscristianos.com.ar\www\carrito\admin\includes\classes\email.php on line 515 but frontend emails works ok... Any help? CODE require_once 'Mail.php'; $user_contact = '[email protected]'; $headers["From"] = $from; $headers["To"] = $to_addr; $headers["Subject"] = $subject; $headers["Bcc"] = "[email protected]"; $params["host"] = "mail.productoscristianos.com.ar"; $params["port"] = "25"; $params["auth"] = true; $params["username"] = "[email protected]"; $params["password"] = "xxxxxxi"; // Create the mail object using the Mail::factory method $mail_object =& Mail::factory("smtp", $params); return $mail_object->send("$to_addr, [email protected]", $headers, $this->output); Link to comment Share on other sites More sharing options...
gortuk Posted July 5, 2005 Share Posted July 5, 2005 Just to shed light on one of the issues here in case people are still stuck on "Cannot redeclare tep_db_connect()". I was running into this error on the admin side. It seems to be due to the new code's reference to mail.php, which includes application_top.php. Since this appears twice on the page, tep_db_connect() is declared twice... I fixed it by changing line 13 in mail.php to require_once('includes/application_top.php'); Now I'm getting this error, the same as Razor7: Fatal error: Class 'Mail' not found in [...]\includes\classes\email.php on line 515 Link to comment Share on other sites More sharing options...
Guest Posted July 5, 2005 Share Posted July 5, 2005 Just to shed light on one of the issues here in case people are still stuck on "Cannot redeclare tep_db_connect()". I was running into this error on the admin side. It seems to be due to the new code's reference to mail.php, which includes application_top.php. Since this appears twice on the page, tep_db_connect() is declared twice... I fixed it by changing line 13 in mail.php to require_once('includes/application_top.php'); Now I'm getting this error, the same as Razor7: Fatal error: Class 'Mail' not found in [...]\includes\classes\email.php on line 515 <{POST_SNAPBACK}> Was curious about this one so I downloaded that Mail::factory contrib. Now it tells you to replace the current email.php files which sit in admin/includes/classes and includes/classes and the code in these require_once 'Mail.php'; $user_contact = '[email protected]'; $headers["From"] = $from; $headers["To"] = $to_addr; $headers["Subject"] = $subject; $headers["Bcc"] = "[email protected]"; $params["host"] = "mail.productoscristianos.com.ar"; $params["port"] = "25"; $params["auth"] = true; $params["username"] = "[email protected]"; $params["password"] = "xxxxxxi" the only mail.php file that exists is in admin/ 2 things the require statement would need to point to the relevant directory to pick it up require_once "../../mail.php"; for the one in admin/includes/classes/ and require_once "../../admin/mail.php"; for the one in includes/classes/ but before you all rush off to try it mail.php does NOT declare a class called Mail and there is certainly no factory function defined, hence the error. I would say there is a file missing here. namely the one that defines the class Mail{} is the contribution incomplete? does it require something else to be installed first? Link to comment Share on other sites More sharing options...
razor7 Posted July 5, 2005 Share Posted July 5, 2005 The Mail class is PHP native, so nothing is missing, also, the same code is working for the frontend, so customers are creating new accounts and requesting invoices and everything is OK with this Mail class native on PHP, but the backend just doesn?t works. That's the problem, not the contribution. Regards. Link to comment Share on other sites More sharing options...
Guest Posted July 5, 2005 Share Posted July 5, 2005 The Mail class is PHP native, so nothing is missing, also, the same code is working for the frontend, so customers are creating new accounts and requesting invoices and everything is OK with this Mail class native on PHP, but the backend just doesn?t works. That's the problem, not the contribution. Regards. <{POST_SNAPBACK}> ah, maybe not. I was aware of a mail() function in core PHP but not a mail class. So had a look at www.php.net under the mail() page in the manual someone had added a comment about a PEAR object (which is where the Mail class comes in). Now it says that PEAR is installed as of PHP 4.0.3. But maybe not if your host has a custom install so first thing to do be to check if PEAR is in your installation. If it is there will be no problem calling Mail::factory Also the code in the example on the PHP site is the same one being banded about here. That line require "Mail.php"; just doesnt make sense to me, the file doesnt exist where it is being called from. It would seem people just copied that could without understanding exactly what it was doing heres the extract from php.net If you can't use or don't understand how to use the sendmail program from linux, you can use a PEAR object to send mail. <? include("Mail.php"); $recipients = "[email protected]"; $headers["From"] = "[email protected]"; $headers["To"] = "[email protected]"; $headers["Subject"] = "Test message"; $body = "TEST MESSAGE!!!"; $params["host"] = "smtp.server"; $params["port"] = "25"; $params["auth"] = true; $params["username"] = "user"; $params["password"] = "password"; // Create the mail object using the Mail::factory method $mail_object =& Mail::factory("smtp", $params); $mail_object->send($recipients, $headers, $body); ?> In my case, i use a smtp server that require authentication, and sendmail configuration is almost cryptic to me. PEAR is already installed in PHP 4.0.3 , if not, you must go to pear.php.net and install it, in my case, I needed to add the Socket.php to the PEAR library. So the person that wrote this was not doing anything specific with osCommerce and I would suggest that the line with include/require/require_once "Mail.php" does not need to be there. And check that PEAR is installed on your server. Link to comment Share on other sites More sharing options...
Guest Posted July 5, 2005 Share Posted July 5, 2005 okay doing a bit more reading on http://pear.php.net/manual/en/package.mail.mail.factory.php require_once 'Mail.php'; is required by PEAR, so apologies for that. So only thing to do would be to check PEAR is installed Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.