PDA

View Full Version : PHP mail doesn't use From field, from is always "Root u



GamePlayHeaven
03-05-2004, 05:45 AM
I'm using the following code in my PHP script:

$strFromSender = "From: NameChanged@OffCourse.com";
mail( $strAddresse, $strSubject, $strContents, $strSender );

It works fine, but the from line in the actual email always contains "Root user".

How can I circumvent this, so that the email recipient sees a From address he would recognise?

GamePlayHeaven
03-05-2004, 05:49 AM
LMAO.... How stupid was that.
I guess we'll put that one under the header "if your explaining it to someone, you solve your own problem".

I'm using the correct parameter in the mail() call now, and everything works fine :)

/crawls away and hides in shame

gnossos
03-08-2004, 03:20 PM
hey, don't hide, I'm still having the same ****ed problem! (and I didn't see what your self revelation was ;) - just haven't noticed the problem in my own bit o stuff yet). What was the epiphany?

wildjokerdesign
03-08-2004, 04:31 PM
He was using $strSender in his mail function when he should have be using $strFromSender I think. Left of the From in the variable

GamePlayHeaven
03-08-2004, 04:45 PM
That was indeed the mistake I made... so stupid lol :)

gnossos
03-08-2004, 08:22 PM
hmnnn...I thought that the mail() function just took 4 variables and the $header variable contained the from field - however, I can't get that to work quite right as I'm using the $header variable and gettin no love regarding the from field, ie., everything's from root.

GamePlayHeaven
03-09-2004, 12:22 AM
Here you go, this should work


// Fill the E-mail fields
$strAddresse = "Addresse@Wherever.com";
$strSubject = "Email header";
$strContents = "Email content\nWith multiple lines" .
$strFromSender = "From: Admin@Your-Domain.com";
// Send the verification E-mail
mail( $strAddresse, $strSubject, $strContents, $strFromSender );