PDA

View Full Version : Auto email header problem


Kal
03-16-2006, 04:50 PM
Hi,

I have script using the mail() function, it works, however when you recieve the email the "from" header has the servers details on, is there any way i can change this so it has my email address instead?

$to = "$customers_email_address";
$subject = "xxx - Login Details Verification";
$headers = "From: xxx <xxx@xxxx.co.uk>";
$body = "xxx\n

Your username is - - - $customers_email_address\n

Your password is - - - $customers_password\n


if (mail($to, $subject, $headers, $body))

{
echo("<p>Message successfully sent!</p>");
}
else
{
echo("<p>Message delivery failed...</p>");
}

thanks in advance

angst
03-16-2006, 05:24 PM
yes, you need to use the -f switch,
example from the manual:

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

I've ran into this problem before, and this switch will fix it.

-SiX

Kal
03-17-2006, 09:20 AM
i've tried to put it within my code but cant seem to get it to work.

Kal
03-20-2006, 11:45 AM
Still having no luck with this problem, does anyone have any other ideas?

GJay
03-20-2006, 12:14 PM
mail($to,$subject,$body,'From: your@email.com');
should work

Kal
03-20-2006, 01:09 PM
thanks, didnt think it was simple.