[BlueOnyx:18730] Re: phpsendmail

Steffan Noord mailinglist at tikklik.nl
Mon Dec 7 04:08:02 -05 2015


Hello Maurice,

Are you still using the script below,
And if so what did you update =

thanxs

-----Oorspronkelijk bericht-----
Van: blueonyx-bounces at mail.blueonyx.it
[mailto:blueonyx-bounces at mail.blueonyx.it] Namens Maurice de Laat
Verzonden: vrijdag 25 oktober 2013 0:34
Aan: BlueOnyx General Mailing List <blueonyx at mail.blueonyx.it>
Onderwerp: [BlueOnyx:13916] Re: phpsendmail

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
_______________________________________________
Blueonyx mailing list
Blueonyx at mail.blueonyx.it
http://mail.blueonyx.it/mailman/listinfo/blueonyx




More information about the Blueonyx mailing list