Skip to content

Sending a Report

Peter van der Woude edited this page Sep 15, 2018 · 4 revisions

Silent Sending

Silent sending of a report is done asynchronously and the events of success/failure can be subscribed to (on the sending thread) by passing an implementation of IReportSendEvent. For example:

...
class MySendEvents : IReportSendEvent
{
  public void Completed(bool success) 
  { 
    Console.WriteLine("Exception Report send completed: " + success); 
  }
  public void ShowError(string message, Exception exception) 
  { 
    Console.WriteLine("Exception Report fail: " + message + Environment.NewLine + exception);
  }
}

...
var er = new ExceptionReporter 
{
  Config =
  {	
    AppName = "PhotoFuzz",
    SendMethod = ReportSendMethod.WebService,
    WebServiceUrl = "http://photofuzz/apiv1"
  } 
}
er.Send(new MySendEvents(), exception);

User Sending

When the option to Show a dialog is set, there are 3 ways for the user to send a report:

Copy

Copy to clipboard (then send it manually eg via chat/email)

Save (to file)

The user will be prompted to select the location and name of the file to save

Send/Email

Sends a report to an Email address or WebService.

  • The button will say "Send" if SendReportMethod is WebService otherwise "Email"

  • Attachments will include all configured files (see FilesToAttach) and if TakeScreenshot is true, the screenshot JPEG file

  • For both Email types (SMTP and SimpleMAPI) files are attached to the email in a single compressed ZIP file. If any of the files to be attached are already zip files (ie end in ".zip") they will be added as separate attachments (just to avoid Russian Dolls with zip files)

Send via 3 methods (see config property SendMethod):

  • SMTP: an e-mail is sent to the email address configured (EmailReportAddress). For SMTP settings see config properties SmtpServer, SmtpFromAddress, and where necessary, SmtpUsername and SmtpPassword. Also

    • SmtpUseSsl
    • SmtpMailPriority
    • SmtpPort and
    • SmtpUseDefaultCredentials etc
  • Simple MAPI: the user's email client will be launched and a new message automatically created and populated with an exception report. The subject, body and recipient are populated from the relevant config properties

    • NB For Simple MAPI to work, the user must have a suitable email client installed (eg Outlook, Windows Mail). This is somewhat of a risk, however, I have found almost all professional/corporate users have no issues with this, so might be a reasonable option for some products
  • WebService: A JSON packet is sent via HTTP POST to a RESTful URL (WebServiceUrl)

Clone this wiki locally