Postgres查询需要能够在$ to中用于电子邮件[关闭]

I have a report that needs to go out to store managers daily. Everything is working except the $to section that needs to call the store managers e-mail. I know this has something to do with the single quotes that are usually around emails, but I can't get this to work properly with all the stuff I've tried. Can someone let me know what I am missing?

$store_managers = $db->getOne("SELECT users.email, store_managers.store FROM users, store_managers
            WHERE users.user_id = store_managers.user_id
            AND store_managers.store = $sNum[$row]");
   if(DB::isError($store_managers)) { echo '<div class="error">Error: - '.$store_managers->getDebugInfo().'</div>';}

$to = '$store_managers';

$headers  = "From: $from
";
$headers .= "CC: $ccList1
";
$headers .= "Content-type: text/html
";

$subject = 'This is a TEST.';

$message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
<html><head></head><body>';
$message .= '<h3>THIS IS A TEST.</h3>';
$message .= '<br /><h5>'.$store_managers.'</h5>';

NOTE: The message syntax used at the end is not working for the $to field. I keep getting a dead.letter... Message saved in etc.

Something obviously wrong in this code in relation with $to is this line:

$to = '$store_managers';

Because when surrounded by single quotes, the $store_managers variable is not interpolated. You don't want these single quotes, do that instead:

$to = $store_managers;