【问题标题】:Send page content to email将页面内容发送到电子邮件
【发布时间】:2012-04-18 12:57:11
【问题描述】:

我想将页面内容发送到电子邮件。 我写了

if($_GET['send_mail'] == 1){
$message = file_get_contents('send_daily_bespoke_call_status.php');
echo "sendmail" . $message;
mail('abc@gmail.com', 'Report for Bespoke Users', $message);    
}

但是页面不会永远加载。 如何将页面内容发送到电子邮件。 我的页面内容有几个数组,所以我不能包含

【问题讨论】:

  • 需要在php.ini中指定正确的smtp服务器

标签: php email


【解决方案1】:

如何使用对象缓冲:

if($_GET['send_mail'] == 1){
    ob_start();
    include 'send_daily_bespoke_call_status.php';
    $output_buffer = ob_get_contents();
    ob_end_clean();
    mail('abc@gmail.com', 'Report for Bespoke Users', $output_buffer);
}

另外,您可以使用 PEAR 的 SMTP 邮件包代替 mail()http://pear.php.net/package/Mail/

【讨论】:

  • 这对我有用。 $body = file_get_contents('send_daily_bespoke_call_status.php'); $body = eregi_replace("[]",'',$body); mail('abc@gmail.com', '定制用户报告', $body);
猜你喜欢
  • 2012-05-25
  • 1970-01-01
  • 2011-05-19
  • 1970-01-01
  • 1970-01-01
  • 2010-12-06
  • 1970-01-01
  • 2014-04-29
  • 1970-01-01
相关资源
最近更新 更多