[BlueOnyx:13916] Re: phpsendmail
Maurice de Laat
mdlaat at muisnetwerken.nl
Thu Oct 24 17:33:54 -05 2013
Hi Steffan,
On Thu, Oct 24, 2013 at 03:55:27PM +0200, Steffan Noord wrote:
> Im using suPHP
> so the vsite has is own php.ini file
> Is it possible to add -f to the sendmail part
> Like
>
> sendmail_path = /usr/sausalito/sbin/phpsendmail -femail at vsite.com
> and if so is there a way to prevent it being overwritten.
Been there, done that :)
See p.e. the thread @
http://mail.blueonyx.it/pipermail/blueonyx/2012-April/010256.html
and its follow-ups.
My current approach is to have an altered /usr/sausalito/sbin/phpsendmail
With this I can put a file in /etc/httpd/conf/sendmail-from/ containing
only the mailaddres that should be used to send bounces to, for a
partiular site. The file should be called site<nr>
My phpsendmail checks if a -f option was given in the phpscript. If not,
it checks for the file /etc/httpd/conf/sendmail-from/site<nr>. If not
found it uses the default admin at hostname.
This works for suphp as well as for regular php.
Here is my phpsendmail, be aware of linewrap:
f=""
if [[ ! " $*" == *" -f"* ]]; then
a=${PWD}
x="${a%%/site*}"
[[ $x = $a ]] && b="" || b=${a:${#x}+5}
x="${b%%/*}"
[[ $x = $b ]] && c="" ||
c=/etc/httpd/conf/sendmail-from/site${b:0:${#x}}
[[ -f $c ]] && f=-f$(<$c)|| f=-fadmin@$HOSTNAME
fi
/usr/bin/logger -p mail.info sendmail-wrapper-php: site=${_HTTP_HOST},
client=${_REMOTE_ADDR}, script=${PWD}${_SCRIPT_NAME}, uid=${UID},
user=${_SOWNER}, from=$f, param=$*
/usr/sbin/sendmail -t -i $f $*
--
Maurice de Laat
More information about the Blueonyx
mailing list