Trouble sending to Yahoo email accounts

I’ve had real trouble with this for about a month now and I’ve nearly got my registration and verification sorted on my website. However, I’ve noticed that sending to Yahoo email accounts are not being received. Sending to gmail and other are fine. I’m using php’s mail function. Now here’s the strange thing, if I set the email address to something like this:


<?php
$to = $email;

mail($email,$subject,$email_message,$headers,"-f my@website.com");
?>

it won’t be received by Yahoo. This will be recieved:


<?php
$to = 'myemail@yahoo.co.uk;

mail($email,$subject,$email_message,$headers,"-f my@website.com");
?>

Any ideas as to why it will be received by setting $to to a set email address rather than using a value from a variable? But email’s have the same content.

I think this code below is not working,
$to = $email;

because $email is empty?

no, $email is set with


$email = $_POST['email'];

with some security.

What’s the purpose of the $to?

The $to just holds the email address I’m sending to.

It doesn’t work if I put this either


mail($email,$subject,$email_message,$headers,"-f contact@website.com");