dongyin0628 2012-04-22 11:03
浏览 54
已采纳

在一个电子邮件中包含一些电子邮件

I have a classifieds website and I am making a mod which will mail my users when an ad is posted in the category and in the city where they are subscribed. Now, I have a problem. I have set this file to run once a day with cronjob. In a day, in my website are 50 ads posted per day so the user gets 50 emails a day. I want to include all the 50 emails in a single one, so the user will get 1 email, but I do not know how to do that. Ex: Each email has one link and 50 emails have 50 links. I want that the users receive only a single email which will have all the 50 links in it. I have tried so many ways, but I could not do it. Every suggestion is welcomed.

Thanks

  • 写回答

3条回答 默认 最新

  • duanli9001 2012-05-06 12:46
    关注

    simply gather your ad-information in an array, where you set the email as array-key.

    $recipients = array();
    while ($row = mysql_fetch_assoc($result)) {
      $email = $row["email"];
      if (!array_key_exists($email, $recipients)) {
        $recipients[$email] = array();
      }
      $recipients[$email][] = $row;
    }
    

    After this, you have an array and each email has a variable number of $row-entries. You just need to add these entries to your mail template using a foreach-loop.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端