PHP & sendmail frustration
Posted by John_Moylan (jfp), 14 August 2003I have to buld send emails out, and need an elegant way of handling the bounce backs.
So I thought reset the return path...anyway
From: this works fine
Subject: this works fine
Reply-to: this works fine
Return-path; THIS FAILS
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 firstname.lastname@example.org
Still no joy, anyone got the Return-path to work?
Posted by Chris_Isaac (Chris Isaac), 14 August 2003Hi
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:
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 2003Well 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 2003I'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 http://uk2.php.net/manual/en/ref.mail.php and search in the page for greywyvern
Posted by John_Moylan (jfp), 16 August 2003yes 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
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.
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: email@example.com • WEB: http://www.wellho.net • SKYPE: wellho