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
最满意答案
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 ...
-
WSO2 CEP - 内存不足(WSO2 CEP - Out of Memory)[2022-04-06]
我发现Siddhi Manager启动一个以Integer.MAX_VALUE为核心池大小的预定线程池。 这意味着每个请求都会创建一个新线程,并且不会超时。 (ref: ThreadPoolExecutor ) 在WSO2解决此问题之前,您可以更改此线程池的大小。 Pe,在类org.wso2.siddhi.core.SiddhiManager中更改该行: this.siddhiContext.setScheduledExecutorService(Executors.newScheduledThreadPo ... -
将AWS Kinesis与wso2cep连接的最佳做法是什么(What is the best practice to connect AWS Kinesis with wso2cep)[2023-07-19]
当您使用具有Storm可伸缩性的WSO2 CEP时,您应该将事件发送到WSO2 CEP,它将把事件发布到Storm并返回结果。 基本上Storm部署将是透明的,您将通过CEP发送和接收事件。 AFAIU您可以通过Kinesis中的消费者使用所需方法向WSO2 CEP发送事件。 CEP支持许多接收器类型 。 您可以参考此处以了解有关部署体系结构和配置的更多信息 本指南介绍了如何创建执行计划并在风暴中部署。 要试用该功能,您可以按照此示例进行操作。 问候 When you are using WSO2 CEP ... -
WSO2 CEP +处理空值(WSO2 CEP + Handle null values)[2022-04-21]
有两种方法可以解决这个问题 在事件接收器输入事件映射中使用默认值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 CEP国营商店(Flink CEP state store)[2024-01-18]
与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 Bucket和BAM Hive脚本部署到多个节点(Deployment of CEP Bucket and BAM Hive scripts to multiple nodes)[2024-03-11]
关于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 ...