Page 1 of 1

mail() header: Return-Path does not take affect...?

Posted: Fri Sep 15, 2006 5:53 am
by ansa
Hi,

I have a mail header like this:

$header .= "Return-Path:andre@shukr.de<Andre> \n";

If I send this email to an unknown email address, the mail delivery error message doesn't arrive back to the Return-Path specified above, but it goes to info@shukr.de, my website's main email address.

I don't know if the following information from phpinfo() helps, but I copied it here anyway:

sendmail_from: root@localhost.com
sendmail_path: /usr/sbin/sendmail -t -i
SMTP: localhost
smtp_port: 25

I might have to change the setup in php.ini, but I don't have access to php.ini because my web server provider resides somewhere else, and for security and technical reasons they can not change the php.ini setup only for me.

How can I deal with it?

Posted: Fri Sep 15, 2006 7:37 am
by Chris Corbyn
You need to use the extra parameters part of the mail() function or use something other than mail().

Posted: Mon Sep 18, 2006 7:24 am
by ansa
Can you tell me a little more?

What kind of extra parameters would I need?

I have used phpmailer() obtained from internet but it doesn't work as well. How many (popular) mail functions are there actually in PHP?

Posted: Mon Sep 18, 2006 8:47 am
by Chris Corbyn
ansa wrote:Can you tell me a little more?

What kind of extra parameters would I need?

I have used phpmailer() obtained from internet but it doesn't work as well. How many (popular) mail functions are there actually in PHP?
See my signature for Swift Mailer if you want a solid solution.

Extra parameters:
The php.net mail() page wrote: additional_parameters (optional)

The additional_parameters parameter can be used to pass an additional parameter to the program configured to use when sending mail using the sendmail_path configuration setting. For example, this can be used to set the envelope sender address when using sendmail with the -f sendmail option.

The user that the webserver runs as should be added as a trusted user to the sendmail configuration to prevent a 'X-Warning' header from being added to the message when the envelope sender (-f) is set using this method. For sendmail users, this file is /etc/mail/trusted-users
Example from mail() page wrote: Example 3. Sending mail with an additional command line parameter.

The additional_parameters parameter can be used to pass an additional parameter to the program configured to use when sending mail using the sendmail_path.

Code: Select all

<?php
mail('nobody@example.com', 'the subject', 'the message', null,
   '-fwebmaster@example.com');
?>

Posted: Mon Sep 18, 2006 10:46 am
by ansa
I've used the -f parameter but it didn't work.

But I will definitely try your swift mailer. So, it handles that return-path problem? I hope you wrote it so easy that such novice like me can work with it :D

Thanks and will get back to you for the result!

Posted: Mon Sep 18, 2006 11:14 am
by Luke
he's got great documentation on the site, so even if you're having a hard time with it, support should be very easy to get. :D