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
 
20.9.2014 - We have just updated our course layouts and descriptions and added our 2015 schedule.

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:
<admin@myserveraccount.com>
when I query the bounced email

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

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

jfp

Posted by Chris_Isaac (Chris Isaac), 14 August 2003
Hi

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:

Code:
Return-Path: <you@yourdomain.com>


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

regards

Chris

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?

jfp

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 http://uk2.php.net/manual/en/ref.mail.php 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
Code:
sendmail_path   =   /usr/sbin/sendmail -t -f address_to@bounce.com


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.

jfp



This page is a thread posted to the opentalk forum at www.opentalk.org.uk 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., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho