Commerce order mail is empty for anonymous users
You have anonymous orders so your code doing the loading of the user account obviously wont work as they dont have a user account: 

 // load user
$user = user_load($order-&gt;uid);
//$user-&gt;name;
$to = $user-&gt;mail;


The above won't work for anonymous users as they don't have an account so the uid is always 0. I think the $order object has $order->mail to get the actual email address used on the order regardless if it was a full user or anonymous