Re: php from address

From: Date: Thu, 25 Jan 2007 17:51:11 +0000
Subject: Re: php from address
References: 1  Groups: php.general php.general 
Request: Send a blank email to php-general+get-247787@lists.php.net to get a copy of this message
Chantal Rosmuller wrote:
Hi everyone, In November I sent a mail to this list asking how to get the mail From header right, I solved that but I still have a problem. The solution was using the -f option like this: $frommail = "user@domain.com"; mail("$to", "$subject", "$message", "$headers","-f$frommail"); The from address is correct now but the displayed name is still www-data (or apache, depends on the server configuration). The header looks like this: From: user@domain.com (www-data) Is there anyway to change this? Thanks, regards Chantal
$frommail = "user@domain.com"; mail("$to", "$subject", "$message", "$headers","-f$frommail"); is an extremely ugly way to pass variables IMO. $frommail = "user@domain.com"; mail($to, $subject, $message, $headers, "-f".$frommail); is a lot nicer IMO. Anyway, to get back to you. The "name" you want would be supplied by having the header From: user@domain.com in the following format: From: MyName Goes Here <user@domain.com>

« previous php.general (#247787) next »