Re: [Hampshire] Sending mail from PHP

Top Page

Reply to this message
Author: Daniel Pope
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Sending mail from PHP
Samuel Penn wrote:
> On Sunday 10 June 2007 18:35, Samuel Penn wrote:
>> Hi,
>>
>> I'm trying to set up DokuWiki to send email on my OpenBSD box, and I'm
>> running into some issues which look like they're PHP related. So, if anyone
>> with PHP knowledge could help, I'd be grateful.
>
> To answer my own email, it looks like PHP requires a shell to be
> around in order to perform an exec, and OpenBSD doesn't include
> sh in the chroot. Sticking sh into the chroot sort of fixed that
> problem, though I don't think I like sh being in there.


Mark Allman/Sparky^, who occassionally pops in here, swears by a library called
PHPMailer[1], which comprises wrapper classes for composing RFC(2)822 and MIME
emails and makes it simple to send via SMTP.

I'm afraid I've never used it myself so I can't offer any personal endorsement,
but I have found for myself that it is only ever less troublesome to send via
SMTP than resolve the issues which can crop up when attempting to pipe via sendmail.

There is a disadvantage, but a minor one: you lose the ability to insert clever
scripts or wrappers in place of the sendmail command.

For even less fuss with respect to changing your code, I believe it's possible
to configure PHP to configure SMTP delivery for mail() directly (because this is
required to be able to send mail on Windows).

Dan

[1] http://phpmailer.sf.net/