additional_parameters

the mail() function

Moderators: egami, macek, gesf

Post Reply
Martin Pickering
New php-forum User
New php-forum User
Posts: 106
Joined: Fri Oct 17, 2003 8:00 am

Fri Jan 18, 2008 5:47 am

I'm using a PHP script to send emails quite successfully. The only problem I'm having is that bounces get returned to my ISP instead of to me!

Code: Select all

$copyto = 'martin@somewhere.com';
$bcopyto = 'martin@somewhere.net';

$headers = 'From: noreply2me@somewhere.biz' . "\r\n" .
 'Reply-To: noreply2me@somewhere.biz' . "\r\n" .
 'Cc: ' . $copyto . "\r\n"  . 
'Bcc: ' . $bcopyto . "\r\n"  . 
 'X-Mailer: PHP/' . phpversion() . "Content-type: text/plain; charset=iso-8859-1\r\n";

//Now email it
    mail($affmail,$messub,$text,$headers . "\r\n");
I have read this page: http://uk.php.net/manual/en/function.mail.php
and I see that I should use "additional_parameters" with -f.

However, I don't understand exactly how to fit this into my $headers string.

Anyone understand this, please?

Martin
(56 year old engineer).

User avatar
AeroX
New php-forum User
New php-forum User
Posts: 140
Joined: Sun May 11, 2008 1:40 am
Location: London, UK
Contact:

Tue May 13, 2008 2:28 pm

It's used like so:

Code: Select all

<?php
...
mail($affmail,$messub,$text,$headers . "\r\n", "-f myfromaddress@mydomain.com");
...
?>
The fifth function input is for adding extra parameters directly to the sendmail program which this function calls.
AeroX.

When posting code to be reviewed please enclose it in the [ code ] [ /code ] tags as it makes it a lot easier for people to read as it correctly formats itself on screen.

Image
    Click Here to Visit[/url]

    Martin Pickering
    New php-forum User
    New php-forum User
    Posts: 106
    Joined: Fri Oct 17, 2003 8:00 am

    Tue May 13, 2008 3:03 pm

    Many thanks for your reply. It works like you say! :)

    Post Reply
    • Information
    • Who is online

      Users browsing this forum: No registered users and 2 guests