Log in

View Full Version : Mail Function problem/question...



adrenalin85
08-04-2007, 06:49 AM
Basically I had a (PHP) contact form on my website which worked fine, but then I transfered the website to another server and it stopped working.

So I started breaking it down and trying to find the problem. There seems to be a conflict with headers, specifically the From part, the script wont run when there is a name addition to the email like this: "From: $name <$email>", but if I change it to this: "From: $email", then it works fine.

It seems like there is nothing wrong with the code since it worked well before on the previous server, so is it possible that the PHP server/software needs to be configured? I am now running on a newer PHP version, could it be that the syntax has changed?

Also I had the script send me the users IP address and some other information that doesnt seem to work anymore either.

Anyway I need some information on this, I would be very thankfull if someone who knows could help me out and explaine this.


Thanks in advance.




Alex.

Twey
08-04-2007, 06:51 AM
Mmm, mail() is touchy like that. Perhaps try sprintf('From: "&#37;s" <%s>', $name, $email)?

adrenalin85
08-04-2007, 06:57 AM
Twey,

I am still learning PHP and dont know some things, could you explain more on what this code you posted does and how to modify it?

Twey
08-04-2007, 07:36 AM
I suspect the sprintf (http://www.php.net/sprintf)() documentation will be more helpful than I would.