Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Emails not being sent after change on server to not allow "nobody" to send emails.


oldford

Recommended Posts

I recently needed to make a security change in WHM to not allows "nobody" to send emails from my server. However, now my store is not sending any email notifications.

 

Is phpsuexec the solution to this? Or is there another solution?

 

Thank you!

Link to comment
Share on other sites

in includes/classes/mail.php

 

This mod will add a Return_Path: to all emails being sent from the catalog server, for the admin you will need to update it's email.php

 

find:

 

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

 

change to

 

$ReturnPath = '-f' . STORE_OWNER_EMAIL_ADDRESS;
  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), $ReturnPath);
  } else {
	return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode($this->lf, $this->headers).$this->lf.implode($this->lf, $xtra_headers), $ReturnPath);
  }
}

 

if this doesn't work then you may need to hard code it like...

 

For an email address of admin @ mydomain.com it would be:

 

***Note no spaces between the ''

 

 

 

 

$ReturnPath = '[email protected]';// hard coded

  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), $ReturnPath);
  } else {
	return mail($to, $subject, $this->output, 'From: '.$from.$this->lf.implode($this->lf, $this->headers).$this->lf.implode($this->lf, $xtra_headers), $ReturnPath);
  }
}

Link to comment
Share on other sites

Thank you pyramids. So the mod you suggested should work with phpsuexec installed? Also, I would need to change my OSC email setting to SMTP, correct? I had been using sendmail previous to this problem.

I don't know about if it will work with phpsuexec installed. You will need to research it more at http://forums.cpanel.net/index.php?

 

You are aware if you install phpsuexec that you will need tweak the scripts - for ex: replace all .htaccess files with ini files.

 

Meanwhile, what is it exactly you want to do by turning off "nobody" as an email user?

(I would assume it was to stop spammers, if so there are other options, see the link in this post and do a search there on the forums)

Link to comment
Share on other sites

Luckily it turns out the problem is solved without needing to modify the code. My server management company made a change in phpsuexec and emails now work.

 

You are aware if you install phpsuexec that you will need tweak the scripts - for ex: replace all .htaccess files with ini files.
Yes, that was a bit of a pain, but overall not too bad.

 

Meanwhile, what is it exactly you want to do by turning off "nobody" as an email user?

(I would assume it was to stop spammers, if so there are other options, see the link in this post and do a search there on the forums)

Yes, security from spam, and more importantly the ability to track down the script allowing the spam to be sent.

 

I didn't spend hours at cpanel forums, but from what I did read most people are in favor of phpsuexec. If you could point me to some of those other options I'd appreciate it.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...