0
我使用這個簡單的腳本檢測網站內容更改和郵件,如果有change.I設置一個cron作業每天運行腳本,它工作正常但當腳本檢測到一個變化時,它發送空白的電子郵件沒有body.Why硫發生了嗎?我在這裏做錯了什麼(在郵件部分)?Cron作業設置爲發送郵件發送空白電子郵件
<?php
$contents = file_get_contents('http://izoneknr.com');
$hash = file_get_contents('../heimdall/heimdall.txt');
if ($hash == ($pageHash = md5($contents)))
{
echo " the content is the same";
}
else
{
$from = "Heimdall";
$EmailTo = "[email protected],[email protected]"; // Your email address here
$Subject = "WEBSITE MODIFICATION ALERT";
$headers.= "MIME-version: 1.0\n";
$headers.= "Content-type: text/html; charset=iso-8859-1\n";
$headers.= "From: $from\n";
$message = '<html><body>';
$message.= '<p>This is an automated response from mysite.The bridge is open.</p><br>';
$message.= '<p>m7mysite has been updated.</p>';
$message = '</body></html>';
$success = mail($EmailTo, $Subject, $message,$headers);
// store the new hash in the file
$fp = fopen('../heimdall/heimdall.txt', 'w');
fwrite($fp, $pageHash);
fclose($fp);
}
謝謝它的工作.. – user3370495 2014-08-28 11:40:22