首页 \ 问答 \ PHP在电子邮件中发送数组记录(PHP Sending array records in email)

PHP在电子邮件中发送数组记录(PHP Sending array records in email)

嗨,有人可以帮我发送一封包含我收集的数组数据的电子邮件吗? 我正在尝试使用数组获取数据库上的记录,然后我会通过电子邮件发送它

这是我的代码:我将首先获得我想要的记录:

$queclient_credit = "SELECT company, credits FROM clients WHERE credits <= 20 and company !='' ORDER BY credits ASC ";
    $getque = mssql_query($queclient_credit) or die();
    while ($rowclient_credit=arrayfetch($getque)){
            $rowcompany = $rowclient_credit['company'];
            $rowcredits = $rowclient_credit['credits'];
Then put it on array:
        $data = array(
                'company'=>$rowcompany,
                'credits'=>$rowcredits
        );


   $dat = implode(' : ', $data);
    }
        if($rowcredits<= 20){
        $from='email@gmail.com';
        $to = 'email@gmail.com';


    $gmailPass = 'password';
    require('phpmailer/5.1/class.phpmailer.php');
    $mail = new PHPMailer();
    $mail->IsSMTP();

    $mail->SMTPAuth = true;

    $mail->SMTPSecure = "ssl";

    $mail->Host = 'smtp.gmail.com';

    $mail->Port = '465';

    $mail->Username = $from;

    $mail->Password = $gmailPass;
    $mail->From = $from;
    $mail->FromName = $from;
    $mail->AddReplyTo($from, $from);
    $mail->Subject = 'Credit System ';
    $mail->Body = $message;
    $mail->MsgHTML('<b><p>'.$dat.' credits<p><b>');
    $mail->IsHTML(true);
    $mail->AddAddress($to, $to);
if(!$mail->Send()){
     // $mail->ErrorInfo;
}else{
    echo 'Message Successfully Sent!';
    $mail->ClearAddresses();
    $mail->ClearAttachments();
    }
}

谢谢你的回答


Hi can someone help me about sending a email with the array data I gathered? I'm trying to fetch records on the DB using array and then I'll email it

Here's my code: I will get the records I want first:

$queclient_credit = "SELECT company, credits FROM clients WHERE credits <= 20 and company !='' ORDER BY credits ASC ";
    $getque = mssql_query($queclient_credit) or die();
    while ($rowclient_credit=arrayfetch($getque)){
            $rowcompany = $rowclient_credit['company'];
            $rowcredits = $rowclient_credit['credits'];
Then put it on array:
        $data = array(
                'company'=>$rowcompany,
                'credits'=>$rowcredits
        );


   $dat = implode(' : ', $data);
    }
        if($rowcredits<= 20){
        $from='email@gmail.com';
        $to = 'email@gmail.com';


    $gmailPass = 'password';
    require('phpmailer/5.1/class.phpmailer.php');
    $mail = new PHPMailer();
    $mail->IsSMTP();

    $mail->SMTPAuth = true;

    $mail->SMTPSecure = "ssl";

    $mail->Host = 'smtp.gmail.com';

    $mail->Port = '465';

    $mail->Username = $from;

    $mail->Password = $gmailPass;
    $mail->From = $from;
    $mail->FromName = $from;
    $mail->AddReplyTo($from, $from);
    $mail->Subject = 'Credit System ';
    $mail->Body = $message;
    $mail->MsgHTML('<b><p>'.$dat.' credits<p><b>');
    $mail->IsHTML(true);
    $mail->AddAddress($to, $to);
if(!$mail->Send()){
     // $mail->ErrorInfo;
}else{
    echo 'Message Successfully Sent!';
    $mail->ClearAddresses();
    $mail->ClearAttachments();
    }
}

Thank you for who will answer


原文:https://stackoverflow.com/questions/37606691
更新时间:2022-10-15 22:10

最满意答案

Esper分析规则并仅存储派生状态(聚合等,如果有的话),并且如果规则需要,还存储事件的子集。 Esper允许定义Opher Etzion和Peter Niblet所描述的上下文。 我建议阅读。 通过指定上下文,Esper可以最小化它保留的状态量,并使查询更容易阅读。


Esper analyzes the rule and only stores derived state (aggregations etc., if any) and if needed by the rule also a subset of events. Esper allows defining contexts like described in the book by Opher Etzion and Peter Niblet. I recommend reading. By specifying a context Esper can minimize the amount of state it retains and can make queries easier to read.

相关问答

更多
  • 在配置中,您需要配置“父选择器XPath表达式”以指示事件的父元素,在本例中为其/result 。 然后应该从父标签引用事件的元素,例如/data/time 有关详细信息,请参阅WSO2 CEP 4.1 XML输入映射文档: https : //docs.wso2.com/display/CEP410/Input+Mapping+Types#InputMappingTypes-XMLinputmappingXMLInputMapping In the configuration you need to co ...
  • 我发现Siddhi Manager启动一个以Integer.MAX_VALUE为核心池大小的预定线程池。 这意味着每个请求都会创建一个新线程,并且不会超时。 (ref: ThreadPoolExecutor ) 在WSO2解决此问题之前,您可以更改此线程池的大小。 Pe,在类org.wso2.siddhi.core.SiddhiManager中更改该行: this.siddhiContext.setScheduledExecutorService(Executors.newScheduledThreadPo ...
  • 当您使用具有Storm可伸缩性的WSO2 CEP时,您应该将事件发送到WSO2 CEP,它将把事件发布到Storm并返回结果。 基本上Storm部署将是透明的,您将通过CEP发送和接收事件。 AFAIU您可以通过Kinesis中的消费者使用所需方法向WSO2 CEP发送事件。 CEP支持许多接收器类型 。 您可以参考此处以了解有关部署体系结构和配置的更多信息 本指南介绍了如何创建执行计划并在风暴中部署。 要试用该功能,您可以按照此示例进行操作。 问候 When you are using WSO2 CEP ...
  • 有两种方法可以解决这个问题 在事件接收器输入事件映射中使用默认值https://docs.wso2.com/display/CEP410/Input+Mapping+Types 在查询https://docs.wso2.com/display/CEP410/SiddhiQL+Guide+3.0#SiddhiQLGuide3.0-QueryProjection中使用Siddhi检查是否is null运算符 There two ways of fixing this Using default values i ...
  • Esper分析规则并仅存储派生状态(聚合等,如果有的话),并且如果规则需要,还存储事件的子集。 Esper允许定义Opher Etzion和Peter Niblet所描述的上下文。 我建议阅读。 通过指定上下文,Esper可以最小化它保留的状态量,并使查询更容易阅读。 Esper analyzes the rule and only stores derived state (aggregations etc., if any) and if needed by the rule also a subset ...
  • 与Flink中的所有有状态操作(例如,窗口,聚合,SQL,计时器等)一样,Flink CEP使用Flink的托管状态 。 如果工作状态被持有,并且持久存在,则取决于使用哪个州后端 。 RocksDB状态后端允许大于适合内存的状态,并且检查点持久存储在持久存储中,例如HDFS,S3或NFS。 Like all stateful operations in Flink (e.g., windows, aggregations, SQL, timers, etc), Flink CEP uses Flink's ...
  • 关于CEP,AFAIK目前没有任何实施可用于将CEP存储区存储在治理注册中心以及来自多个其他CEP节点的访问中。 唯一的方法是在文件系统中部署配置文件(bucket xml)......但是您可以将文本和XML输出映射存储在注册表中,如[1]中所示,并将其用于存储区配置文件。 [1] http://docs.wso2.org/wiki/display/CEP210/Text+Output+Mapping Regarding the CEP, AFAIK at the moment there is no a ...
  • 内存或RDBMS? 内存表将在内部使用java集合结构,因此一旦JVM终止(在服务器重启后,数据将不可用),它将被销毁。 另一方面,RDBMS表将永久保留数据。 对于您的场景,我认为您应该继续使用RDBMS表。 CEP或DAS? CEP将仅提供实时分析,其中除了实时分析之外,DAS还提供批量分析(使用Spark SQL)。 如果您的场景需要批处理,增量处理等......您可以继续使用DAS。 请注意,从CEP到DAS的迁移非常简单(因为工件是相同的)。 默认(H2)DB或其他DB? 默认情况下,WSO2产品 ...
  • 使用Solr,您可以使用RAMDirectoryFactory,它在内存中保存完整索引,而无需编写任何文件: https : //cwiki.apache.org/confluence/display/solr/DataDir+and+DirectoryFactory+in+SolrConfig 快速搜索表明Elasticsearch具有与商店类型=内存相同的等价物,但我对此没有经验。 With Solr you can use the RAMDirectoryFactory, which holds th ...
  • 您可以通过启用快照使CEP保持其状态。 文档可以在这里找到 。 但请注意,这将“定期”保持CEP的“整个状态”(可在几分钟内配置)。 由于这只是定期完成,因此您可能会丢失在上次快照操作后到达的最新几个事件。 如果你想让cep在崩溃后恢复,这是最简单的选择。 除此之外,没有其他方法可以使预定义窗口持久化。 但是如果你愿意,你可以编写一个自己的自定义时间窗口( 文档 ),它将执行持久性并将其插入CEP。 您也可以使用事件表。 使用事件表时,可以确保所有到达的事件都是持久的。 (但这种方法的一个缺点是,与Wind ...

相关文章

更多

最新问答

更多
  • sp_updatestats是否导致SQL Server 2005中无法访问表?(Does sp_updatestats cause tables to be inaccessible in SQL Server 2005?)
  • 如何创建一个可以与持续运行的服务交互的CLI,类似于MySQL的shell?(How to create a CLI that can interact with a continuously running service, similar to MySQL's shell?)
  • AESGCM解密失败的MAC(AESGCM decryption failing with MAC)
  • Zurb Foundation 4 - 嵌套网格对齐问题(Zurb Foundation 4 - Nested grid alignment issues)
  • 湖北京山哪里有修平板计算机的
  • SimplePie问题(SimplePie Problem)
  • 在不同的任务中,我们可以同时使用多少“上下文”?(How many 'context' we can use at a time simultaneously in different tasks?)
  • HTML / Javascript:从子目录启用文件夹访问(HTML/Javascript: Enabling folder access from a subdirectory)
  • 为什么我会收到链接错误?(Why do I get a linker error?)
  • 如何正确定义析构函数(How to properly define destructor)
  • 垂直切换菜单打开第3级父级。(Vertical toggle menu 3rd level parent stay opened. jQuery)
  • 类型不匹配 - JavaScript(Type mismatch - JavaScript)
  • 为什么当我将模型传递给我的.Net MVC 4控制器操作时,它坚持在部分更新中使用它?(Why is it that when I pass a Model to my .Net MVC 4 Controller Action it insists on using it in the Partial Update?)
  • 在使用熊猫和statsmodels时拉取变量名称(Pulling variable names when using pandas and statsmodels)
  • 如何开启mysql计划事件
  • 检查数组的总和是否大于最大数,反之亦然javascript(checking if sum of array is greater than max number and vice versa javascript)
  • 使用OpenGL ES绘制轮廓(Drawing Outline with OpenGL ES)
  • java日历格式(java Calendar format)
  • Python PANDAS:将pandas / numpy转换为dask数据框/数组(Python PANDAS: Converting from pandas/numpy to dask dataframe/array)
  • 如何搜索附加在elasticsearch索引中的文档的内容(How to search a content of a document attached in elasticsearch index)
  • LinQ to Entities:做相反的查询(LinQ to Entities: Doing the opposite query)
  • 从ExtJs 4.1商店中删除记录时会触发哪些事件(Which events get fired when a record is removed from ExtJs 4.1 store)
  • 运行javascript后如何截取网页截图[关闭](How to take screenshot of a webpage after running javascript [closed])
  • 如何使用GlassFish打印完整的堆栈跟踪?(How can I print the full stack trace with GlassFish?)
  • 如何获取某个exe应用程序的出站HTTP请求?(how to get the outbound HTTP request of a certain exe application?)
  • 嗨,Android重叠背景片段和膨胀异常(Hi, Android overlapping background fragment and inflate exception)
  • Assimp详细说明typedef(Assimp elaborated type refers to typedef)
  • 初始化继承类中不同对象的列表(initialize list of different objects in inherited class)
  • 使用jquery ajax在gridview行中保存星级评分(Save star rating in a gridview row using jquery ajax)
  • Geoxml3 groundOverlay zIndex(Geoxml3 groundOverlay zIndex)