在几个 Delphi XE2 项目中,我设置了 Eurekalog 以通过“HTTP 上传”发送错误报告,效果很好,因为我使用 PHP 脚本捕获错误报告,将其保存在目录中并通过电子邮件发送给我:
<?php
require 'PHPMailerAutoload.php';
foreach ($_FILES as $key => $value)
{
$uploaded_file = $_FILES[$key]['tmp_name'];
$server_dir = 'upload/';
$server_file = $server_dir . date("Y-m-d H-i-s ") . basename($_FILES[$key]['name']);
$ext = strtoupper(pathinfo($server_file, PATHINFO_EXTENSION));
if ($ext != 'EL')
{
continue;
}
if (move_uploaded_file($uploaded_file, $server_file))
{
echo '<html>';
echo '<head>';
echo '<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="TEXT/HTML; CHARSET=UTF-8">';
echo '<title>Bug submission</title>';
echo '</head>';
echo '<body>';
echo 'Thank you!<br />';
echo "<!--\n";
echo "<EurekaLogReply>Thank you for your feedback!</EurekaLogReply>\n";
echo "-->";
echo '</body>';
echo '</html>';
SendBugReportMessage('auserofmyprogram@usersofmyprogram.com',
'A User of my program',
'Eurekalog Bug Report',
'This is a bug report from Eurekalog.',
'eurekalog.bugreport@mysite.com',
$server_file,
basename($server_file)
);
}
}
function SendBugReportMessage($AFrom, $AFromName, $ASubject, $ABodyText, $ARecipient, $AFileToAttach, $ANameOfFile)
{
$email = new PHPMailer();
$email->From = $AFrom;
$email->FromName = $AFromName;
$email->Subject = $ASubject;
$email->Body = $ABodyText;
$email->AddAddress($ARecipient);
$file_to_attach = $AFileToAttach;
$email->AddAttachment($file_to_attach, $ANameOfFile);
return $email->Send();
}
?>
现在我有几个程序使用这个相同的 PHP 脚本来上传他们的错误报告。但是,发送到此 PHP 脚本的错误报告始终名称为“BugReport”。那么,在 PHP 脚本中如何获取发送错误报告的程序的名称,以便我可以通过附加程序名称来保存它并将程序名称包含在邮件主题中?或者是否可以通过在 Delphi 代码的一侧实现某些东西来解决?还是在Eurekalog?
Eurekalog 版本是 7.1.0.0