Mail in a Jail

Brent Wiese brently at bjwcs.com
Mon Jan 12 17:22:34 PST 2004


> Hi,
> 
> I run my web sites from a jail. The time has come that i now 
> need to send an
> email from one of those sites using the mail() function in php.
> 
> I would like to know, what files do i need to be able to send 
> mail from the
> jail using the mail command. The box is using sendmail as its 
> mta, and is
> running 4.9 release.

This plagued me too. I found a very easy solution: esmtp in the ports.

A few catches:

1: You need an external SMTP server that will relay the mail for you. I was
unable to get it to talk to the main host's SMTP, probably a "feature" of
jailing... Luckily, I have another box on the LAN who's sole purpose is to
relay mail for machines on the LAN.

2: After you install esmtp, change your sendmail links (/usr/sbin/sendmail
at least I think) to point at it. 

3: If you compiled PHP w/ a non-existent sendmail, you have to recompile.
It's a little confusing, but if you dig far enough in the docs, mail() will
not compile if sendmail doesn't exist (it tests).

Enjoy!
Brent




More information about the freebsd-questions mailing list