Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Email in OpenBSD chroot


Dirk-san

Recommended Posts

Hello,

 

I am running OSC on OpenBSD 3.6. The web server is chrooted and while I can access the database via socket, OSC (unlike say phpBB) doesn't emails because, due to the chroot certain libraries or whatever are not available.

 

I have found a solution that lets PHP send email OK using phpmailer functions, however it doesn't seem to help with OSC without some hacking, which at this time I don't feel capable of. (see here)

 

Has anybody made OSC with email work on OpenBSD while maintaining the chroot?

 

Thanks

 

Dirk

Link to comment
Share on other sites

are you using sendmail on openbsd? shouldnt have to do much, if you need smtp authentication, you can do so, (contribution for that)

 

um, is this your own server at home or are you at a host?

Link to comment
Share on other sites

Hi there,

 

thanks for responding.

 

Yes, the server is my own, so I can do what I like :thumbsup: But I would really like to maintain the chroot.

 

I am using Postfix instead of sendmail. But the sendmail option won't work because there are no binaries for that available to Apache. I know there is a workaround called mini_sendmail, but it needs a copy of the sh binary, and again that is something I would like to avoid.

 

So for example in phpBB, I set it to SMTP and the server to localhost or 127.0.0.1 and the email works. I have to check how they do their mail.

 

So currently OSC reports that the emails were sent successfully, but nothing in the maillog.

 

Since the example simple PHP mail script that I referenced in my initial post works now, I would like OSC to behave the same way, i.e. with the help of phpmailer code.

 

Cheers

 

Dirk

Link to comment
Share on other sites

OK, I fixed it, but it is a raw hack.

 

Inserted into both instances of email.php:

 

Somewhere at the beginning:

 

require("class.phpmailer.php");  

 

Then replaced

 

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

 

with

 

      if (EMAIL_TRANSPORT == 'smtp') {
       $mail = new PHPMailer();
       $mail->IsSMTP();
       $mail->AddAddress($to_addr);
       $mail->Subject = $subject;
       $mail->Host = "localhost";
       $mail->From = $from;
       $mail->FromName = $from_name;
       $mail->Body = $this->output;
       
       if(!$mail->Send()) {
               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));
     }

 

Plus, as quoted the instructions from here.

 

This seems to work most of the time, which is good enough for me for now.

 

Thanks for looking.

Link to comment
Share on other sites

  • 1 year later...

dirk-san,

 

i'd just like to say thanks a ton for having posted this. i had used this hack that mr. velasco posted on misc@ quite some time ago but was unable to find it again recently. your post did helped me find it and now the emails work just right :).

 

cheers

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...