doufei16736 2013-02-20 20:09
浏览 24
已采纳

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.

  • 写回答

1条回答 默认 最新

  • dpaal28266 2013-02-20 23:23
    关注

    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;
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数