简体   繁体   English

Cron作业到电子邮件表

[英]Cron Job to Email Table

I want to setup a cron job (I think this is my best option) to automatically email me a table of open orders from my mySQL DB each morning. 我想设置一个cron作业(我认为这是我最好的选择),以便每天早上自动通过电子邮件将来自mySQL DB的未结订单表发送给我。
I have a php page which displays the table, and I was hoping to just be able to use that. 我有一个显示该表的php页面,我希望能够使用它。 However, as most of you probably know what happened, it ran the file and emailed me all the html as text (yes my gMail allows html emails). 但是,由于大多数人可能都知道发生了什么,因此它运行了文件并通过电子邮件将所有html作为文本发送给我(是的,我的gMail允许html电子邮件)。 What do I need to look up to create my table and email it to me. 我需要查找什么来创建表格并将其通过电子邮件发送给我。 thanks. 谢谢。

I am assuming you are invoking somewhere in your PHP code something like the following: 我假设您正在调用PHP代码中的某处,如下所示:

mail($to, $subject, $message, $headers);

If so, check a couple basic things: 如果是这样,请检查以下几项基本内容:

  1. Your $message variable begins with: 您的$ message变量开头为:

     <html> 
  2. Your $message variable ends with: 您的$ message变量结尾为:

     </html> 
  3. You've added the HTML content type to your message headers, for example using the code: 您已经将HTML内容类型添加到了邮件标题中,例如使用以下代码:

     $headers .= "Content-type: text/html\\r\\n"; 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM