Jump to content



Latest News: (loading..)

- - - - -

Configuring SMTP

smtp configuration

  • Please log in to reply
1 reply to this topic

#1   bartfriederichs

bartfriederichs
  • Members
  • 2 posts
  • Real Name:Bart Friederichs

Posted 17 July 2012 - 09:34 AM

Hi all,

I am having some issues with the SMTP mail transport method. I selected SMTP because I have to: the server that runs the osCommerce installation is not allowed to send mail; we have an SMTP server for that. They are all running Linux (CentOS 5.8). However, if I dive into the code, I find this:

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

I cannot provide a server.

How can I fix that?

#2   bartfriederichs

bartfriederichs
  • Members
  • 2 posts
  • Real Name:Bart Friederichs

Posted 17 July 2012 - 10:02 AM

I have made a minor change to use Pear::Mail

in catalog/admin/classes/email.php, on top

include ("Mail.php");

and then in send() replace the last lines :

	  if (EMAIL_TRANSPORT == 'smtp') {
		  $m = new Mail();
		  $m = Mail::factory("smtp");
		  $m->host = "your.smtp.host";
		  $headers =	 array("From"=>$from,
				  "Subject"=>$subject,
				  "X-Mailer"=>"osCommerce v".$version,
				  "MIME-Version"=>"1.0",
				  "Content-Type"=>"text/plain",
				  "To"=>$to_addr);
		  $__m = $m->send($to_addr, $headers, $this->output);
		  
		  if (PEAR::IsError($__m)) {
			  return FALSE;
		  } else {
			  return TRUE;
		  }		  
	  } else {
		return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode($this->lf, $this->headers).$this->lf.implode($this->lf, $xtra_headers));
	  }