StockExpert
asked on
Oscommerce website gives an emailing error.
I am using oscommerce on my commerce website. I am getting the following message at the point where the site send an email to a customer, like sending password to the customer. The site is on Windows 2003 with IIS 6.
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in e:\webaddress\shop\include s\classes\ email.php on line 500
The related code on line 500 is: return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode( $this->lf, $this->headers).$this->lf. implode($t his->lf, $xtra_headers));
The following is the subsequent codes around line 500.
if (EMAIL_TRANSPORT == 'smtp') {
return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode( $this->lf, $this->headers).$this->lf. implode($t his->lf, $xtra_headers));
/*
require_once(DIR_WS_CLASSE S . "class.phpmailer.php");
$pMail = PHPMailer();
$pMail->From = $from_addr;
$pMail->FromName = $from_name;
$pMail->IsSMTP();
$pMail->Host = localhost; // replace with your smtp server
$pMail->Subject = $subject;
$pMail->Body = $this->output;
$pMail->AddAddress($to_add r, $to_name);
$pMail->IsHTML(true);
return $pMail->Send();
$pMail->ClearAddresses();
$pMail->ClearAttachments() ;
*/
} else {
return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode( $this->lf, $this->headers).$this->lf. implode($t his->lf, $xtra_headers));
}
}
Can someone help? Many thanks.
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in e:\webaddress\shop\include
The related code on line 500 is: return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode(
The following is the subsequent codes around line 500.
if (EMAIL_TRANSPORT == 'smtp') {
return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode(
/*
require_once(DIR_WS_CLASSE
$pMail = PHPMailer();
$pMail->From = $from_addr;
$pMail->FromName = $from_name;
$pMail->IsSMTP();
$pMail->Host = localhost; // replace with your smtp server
$pMail->Subject = $subject;
$pMail->Body = $this->output;
$pMail->AddAddress($to_add
$pMail->IsHTML(true);
return $pMail->Send();
$pMail->ClearAddresses();
$pMail->ClearAttachments()
*/
} else {
return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode(
}
}
Can someone help? Many thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Changed it to the IP address of the server. it makes the error message different. now:
Warning: Cannot modify header information - headers already sent by (output started at e:\webaddress\shop\include s\classes\ email.php: 1) in e:\webaddress\shop\include s\function s\general. php on line 29
the line 29 in general.php isheader('Location: ' . $url);
what should i do now?
Thanks.
Warning: Cannot modify header information - headers already sent by (output started at e:\webaddress\shop\include
the line 29 in general.php isheader('Location: ' . $url);
what should i do now?
Thanks.
ASKER
Here is more information around the line 29
// Redirect to another page or site
function tep_redirect($url) {
if ( (ENABLE_SSL == true) && (getenv('HTTPS') == 'on') ) { // We are loading an SSL page
if (substr($url, 0, strlen(HTTP_SERVER)) == HTTP_SERVER) { // NONSSL url
$url = HTTPS_SERVER . substr($url, strlen(HTTP_SERVER)); // Change it to SSL
}
}
header('Location: ' . $url); <b>***this is line 29***** </b>
tep_exit();
}
// Redirect to another page or site
function tep_redirect($url) {
if ( (ENABLE_SSL == true) && (getenv('HTTPS') == 'on') ) { // We are loading an SSL page
if (substr($url, 0, strlen(HTTP_SERVER)) == HTTP_SERVER) { // NONSSL url
$url = HTTPS_SERVER . substr($url, strlen(HTTP_SERVER)); // Change it to SSL
}
}
header('Location: ' . $url); <b>***this is line 29***** </b>
tep_exit();
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Enphyniti: I checked any white space, corrected and it still the same.
I have to change my comment above. After changing the localhost to the ip address it still generates the same error. I was using google chrole and saw this error.
Warning: mail() [function.mail]: Failed to connect to mailserver at "70.62.159.243" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in e:\webaddress\shop\include s\classes\ email.php on line 500
Warning: Cannot modify header information - headers already sent by (output started at e:\webaddress\shop\include s\classes\ email.php: 1) in e:\webaddress\shop\include s\function s\general. php on line 29
Somehow, I changed the browser to IE and it didn't show the first error. I thought the change made the difference. I changed back to google chrome, it's now same as the original.
Any other idea? Thanks.
I have to change my comment above. After changing the localhost to the ip address it still generates the same error. I was using google chrole and saw this error.
Warning: mail() [function.mail]: Failed to connect to mailserver at "70.62.159.243" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in e:\webaddress\shop\include
Warning: Cannot modify header information - headers already sent by (output started at e:\webaddress\shop\include
Somehow, I changed the browser to IE and it didn't show the first error. I thought the change made the difference. I changed back to google chrome, it's now same as the original.
Any other idea? Thanks.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
telnet definedSMTPserver 25...
it says: could not connect to the host, on port 25: connect failed
hmmm... looks like the port doesnt have the definedsmtp...
it says: could not connect to the host, on port 25: connect failed
hmmm... looks like the port doesnt have the definedsmtp...
What's your host ?
check services - is smtp running?
ASKER
oh... I see what you mean now... I am trying again
ASKER
the ip is 70.62.159.243
can you do that for me and let me know what's going on? i am getting errors...
can you do that for me and let me know what's going on? i am getting errors...
Looks like SMTP is not configured to accept on port 25, or a firewall may be interfering. Make sure the SMTP service is running and the port is open on any firewalls on the server.
ASKER
try it again. the relay was off and it's on now. if you still think that the port is closed, let me know. the firewall was/is off. smtp service is running too.
Connexion to port 25 : OK
Connexion to mail server : Bad
Connexion to mail server : Bad
ASKER
the webserver sends email without problems in some asp web applications, using the smtp virtual server. the problem is only in this php website.
ASKER
Connexion to mail server : Bad
how can i fix it? what is "Bad" mean?
how can i fix it? what is "Bad" mean?
Since your app and your mailserver are on the same system, don't use your external IP. Use either localhost, 127.0.0.1, or the LAN ip.
I cannot connect to 70.62.159.243 on 25. it drops the connection.
I cannot connect to 70.62.159.243 on 25. it drops the connection.
ASKER
Enphyniti: can you try it again connecting to 70.62.159.243? it should work now.
i changed it to 127.0.0.1. it still the same...
i changed it to 127.0.0.1. it still the same...
ASKER
this is the line 500:
return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode( $this->lf, $this->headers).$this->lf. implode($t his->lf, $xtra_headers));
if i remove this line from the code, it goes. and leave the following error
Warning: Cannot modify header information - headers already sent by (output started at e:\www.greencash.us\shop\includes\classes\email.php:1) in e:\www.greencash.us\shop\includes\functions\general.php on line 29
return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode(
if i remove this line from the code, it goes. and leave the following error
Warning: Cannot modify header information - headers already sent by (output started at e:\www.greencash.us\shop\includes\classes\email.php:1) in e:\www.greencash.us\shop\includes\functions\general.php on line 29
-
ASKER
Solution: I found a blank space after the end of config.php file. sigh... removing this space solved this problem. I send many thanks to experts who helped me in this question. You guys are great!
Good news! Thanks for the points! Happy new year!
ASKER
running on port 25
it accepts unauthorized relay
Can you explain detail: " verify the email settings from the web host and plug those values in."
Thanks.