// See also: http://pastebin.com/MfLi4pbj - "how to send arbitrary e-mail with file attaches"
// See also: http://pastebin.com/jxKB2WDZ - "how to send arbitrary data to bug tracker"
// See also: http://pastebin.com/ytYbgAfc - "how to setup send method from code"
// This code requires EurekaLog enabled for your application
// You also must properly configure at least one send method to submit bug reports
// This code will use existing EurekaLog configuration to send feedback message
uses
EConsts, ETypes, EClasses, EHash, ESysInfo, ESend, ExceptionLog7;
procedure TForm1.Button1Click(Sender: TObject);
var
Options: TEurekaModuleOptions;
Files: TStringList;
begin
Options := TEurekaModuleOptions.Create('');
Files := TStringList.Create;
try
Options.Assign(CurrentEurekaLogOptions);
// 1: store your feedback message
Options.CustomField[sifBugText] := 'Your feedback message';
Options.CustomField[sifBugType] := 'Short caption (subject)';
// 2: you have to redefine BugID, so it will unique identify this message
Options.CustomField[sifBugID] := IntToHex(GetCRC32(Options.CustomField[sifBugType] + Options.CustomField[sifBugText]), 8);
// 3: (optional) add additional text, if needed
Options.CustomField[sifMessage] := 'usually this holds bug report text, you can replace it with any content or empty string';
Options.CustomField[sifStepsToReproduce] := 'steps to reproduce';
// 4: (optional) you may want to change caption/category/project/etc. for feedbacks
Options.SendMantisCategory := 'Feedback'; // this is just example
// 5: (optional) fill other informational fields
Options.CustomField[sifBugAppVersion] := ESysInfo.GetVersionNumber;
Options.CustomField[sifBuild] := ESysInfo.GetVersionNumber;
Options.CustomField[sifMachineID] := ESysInfo.GetComputerName;
Options.CustomField[sifOSBuild] := ESysInfo.GetOSBuild;
Options.CustomField[sifOSType] := ESysInfo.GetOSTypeStr;
Options.CustomField[sifPlatform] := ESysInfo.GetPlatform;
Options.CustomField[sifUserEMail] := ESysInfo.GetUserEMail;
// 6: attach files (if any)
Files.Add('C:\FileToSend1.txt');
Files.Add('C:\FileToSend2.zip');
EurekaLogSend(Options, Files);
finally
FreeAndNil(Files);
FreeAndNil(Options);
end;
end;
Comments