Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

sending order email prevents checkout_success.php from showing


Guest

Recommended Posts

i have a problem with my osc ms2 version - stock version mind u - each time i order a product - i go through process normally - then click on confirm order button - it takes me to shopping_cart.php page stating that the cart is empty even though there were products in the cart. it does not show me the checkout_success.php page stating the order went though successfully.

 

when i view my account - the order is logged - so the order does go though - and it is logged in admin as well.

 

i'v managed to track the problem to my includes/classes/email.php page - when i comment out some of the code my site works fine - but of course - does not send the emails as its commented out.

 

here is the code that is giving me grief. i might add that i have not modified this page or any section that sends out the emails at all.

 

can someone please help me to fix it?

 

/**
* Sends the mail.
*/

function send($to_name, $to_addr, $from_name, $from_addr, $subject = '', $headers = '') {
  if ((strstr($to_name, "\n") != false) || (strstr($to_name, "\r") != false)) {
	return false;
  }

  if ((strstr($to_addr, "\n") != false) || (strstr($to_addr, "\r") != false)) {
	return false;
  }

  if ((strstr($subject, "\n") != false) || (strstr($subject, "\r") != false)) {
	return false;
  }

  if ((strstr($from_name, "\n") != false) || (strstr($from_name, "\r") != false)) {
	return false;
  }

  if ((strstr($from_addr, "\n") != false) || (strstr($from_addr, "\r") != false)) {
	return false;
  }

  $to = (($to_name != '') ? '"' . $to_name . '" <' . $to_addr . '>' : $to_addr);
  $from = (($from_name != '') ? '"' . $from_name . '" <' . $from_addr . '>' : $from_addr);

  if (is_string($headers)) {
	$headers = explode($this->lf, trim($headers));
  }

  for ($i=0; $i<count($headers); $i++) {
	if (is_array($headers[$i])) {
	  for ($j=0; $j<count($headers[$i]); $j++) {
		if ($headers[$i][$j] != '') {
		  $xtra_headers[] = $headers[$i][$j];
		}
	  }
	}

	if ($headers[$i] != '') {
	  $xtra_headers[] = $headers[$i];
	}
  }

  if (!isset($xtra_headers)) {
	$xtra_headers = array();
  }

  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));
  }
}

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...