additional_parameters

the mail() function

Moderators: macek, egami, gesf

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

additional_parameters

Postby Martin Pickering » 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: 142
Joined: Sun May 11, 2008 1:40 am
Location: London, UK
Contact:

Re: additional_parameters

Postby AeroX » 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.

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

Re: additional_parameters

Postby Martin Pickering » Tue May 13, 2008 3:03 pm

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


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 1 guest

cron