2010-06-26 98 views
0

我想在垃圾郵件發送給用戶之前使用垃圾郵件刺客對垃圾郵件進行評分。我正在使用PHP執行它作爲使用exec的過程。給予無效輸出的垃圾郵件刺客

exec("/usr/bin/spamc -R < {$fname}",$score,$rr); 

問題是返回的結果總是0/0。我從PHP類網站獲取了PHP代碼。正在使用的演示消息低於

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html> 
<head> 
<title>free free</title> 
<meta content="false" http-equiv="imagetoolbar"> 
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"> 
</head> 
<body> 
viagra test test free free 
</center></body></html> 

請建議可能是什麼問題

+0

您在使用$ fname的完整文件路徑? – 2010-06-26 10:52:12

+0

是的.. '$ fname = tempnam(「/ tmp」,「sa」);' – Sam 2010-06-28 04:28:32

+0

如果我在我的其他網站上使用相同的腳本,它的工作正常。這應該是一個垃圾郵件刺客配置問題。任何人都可以建議什麼是從零開始做必要的配置? – Sam 2010-06-28 07:44:41

回答

0

嘗試使用proc_open改變了方式,你管你的電子郵件的內容,而不是exec

$email_content = "Put your email content here." 

$descriptorspec = array(
    0 => array("pipe", "r"), // stdin read by child 
    1 => array("pipe", "w"), // stdout written to by child 
    2 => array("file", "/tmp/spamd-error-output.txt", "a") // stderr 
); 

$process = proc_open("/usr/bin/spamc -R", $descriptorspec, $pipes); 

if (is_resource($process)) { 
    fwrite($pipes[0], $email_content); 
    fclose($pipes[0]); 
    $full_output = fgets($pipes[1], 1024); 
}