Are you using sendmail? Where does the "www-data@" come from? Is "www-data" the name of the user under which Apache (or PhP) is running when it sends the mail out?
Let's make one thing clear: the From: address you wrote in your PhP script goes into the mail header as the from address, but it's not the actual sender address that the remote mail server (in this case, hotmail's mx3 machine) takes into account. This address, called the envelope address, is different from your from: address.
This is shown by looking at the FROM:<...> part of the error message, which is the sender address, as seen by hotmail's mail server.
So, the point is, that you don't want to change your From: address. It's probably just find. It's the envelope address that seems to be wrong. It contains "www-data@", which is clearly an invalid mail address, hence the error you're seeing.
Normally, those envelope sender addresses get written automatically by your mail system and they contain your_user@your_computer.your
_domain where your_computer is sometimes omitted.
So, my guess is that you're running PhP under the user "www-data", either via a webserver (Apache) or
directly. But your system didn't add your domain. So you may need to check some hostname configuration issues.
If I'm not mistaken, I've seen a similar issue on this forum for someone who didn't have the right entries in /etc/hosts.
So, could you please post the contents of:
and the result of the hostname or uname -a commands?
As for the configuration of your mail server. Well, it could be that the mail server was wrongly configured to not add your domain at the end of the envelope address, which is not the default behaviour.
What mail server are you using?
Could you also please post your php.ini settings that are related to mails and SMTP, please?