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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ansa
Forum Commoner
Posts: 31
Joined: Tue Aug 29, 2006 1:58 am
Location: Hamburg, Germany

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

Post 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?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

You need to use the extra parameters part of the mail() function or use something other than mail().
ansa
Forum Commoner
Posts: 31
Joined: Tue Aug 29, 2006 1:58 am
Location: Hamburg, Germany

Post 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?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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');
?>
ansa
Forum Commoner
Posts: 31
Joined: Tue Aug 29, 2006 1:58 am
Location: Hamburg, Germany

Post 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!
User avatar
Luke
The Ninja Space Mod
Posts: 6424
Joined: Fri Aug 05, 2005 1:53 pm
Location: Paradise, CA

Post 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
Post Reply