Dont ask me why, probably 3am creeping up on me, but why do you have in the mail function args in the example as so?
$testvar=mail(\"user@domain.com\", \"test\", \"test\");
It should look like so
$testvar=mail("user@domain.com", "test","test");
Plus also some mail servers check the message headers, and according to the code you gave, you do not have a From header set, which can cause the message to be rejected by some mail servers.
If I were you, I'd check the mail logs after sending the test through the script, it could indicate what I said above, which looks like the cause of it, and/or give you an idea of whats going on.
Sendmail by default in newer dists of linux and unix has spam filtering enabled, where if the user is not local(ie: different email domain), it will bounce back, and since no From field is set then the email goes into limbo. So it all goes back to having to check the log files. I think the problem though is that you added slashes infront of the quotes.
On a *nix to check sendmail logs, you would view the file /var/log/maillog
Here is a brief explaination of quotes and slashes.
$string = " This is why you use this \" so it prints the quote without being the end of the string";
There are other things that the backslash does, like if you wanted to print out a backslash in a string you would have to add this where you want the backslash
$date = "current directory is c:\temp\";
that would print out:
current directory is c:\temp\
Sorry for the detailed explaination but in the above example you gave you added the \" where it should just a be quotation mark.