Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
For 2023 (and 2024 ...) - we are now fully retired from IT training.
We have made many, many friends over 25 years of teaching about Python, Tcl, Perl, PHP, Lua, Java, C and C++ - and MySQL, Linux and Solaris/SunOS too. Our training notes are now very much out of date, but due to upward compatability most of our examples remain operational and even relevant ad you are welcome to make us if them "as seen" and at your own risk.

Lisa and I (Graham) now live in what was our training centre in Melksham - happy to meet with former delegates here - but do check ahead before coming round. We are far from inactive - rather, enjoying the times that we are retired but still healthy enough in mind and body to be active!

I am also active in many other area and still look after a lot of web sites - you can find an index ((here))
PHP & sendmail frustration

Posted by John_Moylan (jfp), 14 August 2003
I have to buld send emails out, and need an elegant way of handling the bounce backs.

So I thought reset the return path...anyway

<Email headers>
From: this works fine
Subject: this works fine
Reply-to: this works fine
Return-path; THIS FAILS
</Email headers>

The return path is always set to:
when I query the bounced email

I have tried setting the return path in php.ini to:
sendmail_path   =   /usr/sbin/sendmail -t -f

Still no joy, anyone got the Return-path to work?


Posted by Chris_Isaac (Chris Isaac), 14 August 2003

I've never actually tried using sendmail, so I'm kind of weeing in the wind, but an example I've seen had the line down as:

Return-Path: <>

only difference I could see from yours was the capital P in path and colon rather than semi, may be worth a try?



Posted by John_Moylan (jfp), 14 August 2003
Well I managed it in the end,. The semi colon in my example was my typo while inputting here.

Anyway, the php.ini version worked in the end, don't know what it was cos I broke a rule and changed a couple of things at once...naughty.

But at least I now bounce to where I want.

thanks for the reply Charles.

Has anyone got this to work without resorting to a php.ini config change?


Posted by admin (Graham Ellis), 15 August 2003
I'm coming to this one a bit late, but I just did a bit of testing ... sending out emails to myself with return path set in the mail function.  I looked at the full headers when the message reached me, and found that the return path had been changed.  Conclusion (perhaps one the rest of you have reached already!) is that you can't change the return path in the mail function as it'll get over-ridden (on many systems at least).

I also checked various manuals - no direct reference, but on the php web site I did find a user posted script which sidesteps the mail function (in order to send out multiple mails in a single connection) and it specifies a return path.    Considering the jfp is looking to send out multiple emails, the script may be useful to him for other reasons too - see and search in the page for greywyvern

Posted by John_Moylan (jfp), 16 August 2003
yes Graham, it was a conclusion that I finally came too.

The only way to do this is as an arg to sendmail itself, and not via a php function. (Though I haven't tested the fifth arg to the mail() function I recently found out about which may do this)

I did this in the end in my php.ini
sendmail_path   =   /usr/sbin/sendmail -t -f

Thinks: Could always bypass the mail() function and pipe to sendmail and add the -f option there, probably makes more sense to do it that way.


This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2024: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: • WEB: • SKYPE: wellho