@@ -256,13 +256,13 @@ private void Send(Exception exception, bool silent)
256256 Debug . Write ( e . Message ) ;
257257 }
258258
259+ if ( string . IsNullOrEmpty ( FromEmail ) )
260+ {
261+ throw new ArgumentNullException ( @"FromEmail" ) ;
262+ }
263+
259264 if ( ! AnalyzeWithDoctorDump )
260265 {
261- if ( string . IsNullOrEmpty ( FromEmail ) )
262- {
263- throw new ArgumentNullException ( @"FromEmail" ) ;
264- }
265-
266266 if ( string . IsNullOrEmpty ( SmtpHost ) )
267267 {
268268 throw new ArgumentNullException ( "SmtpHost" ) ;
@@ -301,6 +301,7 @@ internal void SendReport(bool includeScreenshot,
301301 string userMessage = "" )
302302 {
303303 string subject = String . Empty ;
304+
304305 if ( string . IsNullOrEmpty ( from ) )
305306 {
306307 from = ! string . IsNullOrEmpty ( FromEmail )
@@ -318,14 +319,13 @@ internal void SendReport(bool includeScreenshot,
318319 }
319320 else
320321 {
321- SendEmail ( includeScreenshot , smtpClientSendCompleted , from , subject , userMessage ) ;
322+ SendEmail ( includeScreenshot , smtpClientSendCompleted , subject , userMessage ) ;
322323 }
323324 }
324325
325326 #region Send Email Using SMTP
326327
327- private void SendEmail ( bool includeScreenshot , SendCompletedEventHandler smtpClientSendCompleted , string from ,
328- string subject , string userMessage )
328+ private void SendEmail ( bool includeScreenshot , SendCompletedEventHandler smtpClientSendCompleted , string subject , string userMessage )
329329 {
330330 if ( string . IsNullOrEmpty ( subject ) )
331331 {
@@ -341,7 +341,8 @@ private void SendEmail(bool includeScreenshot, SendCompletedEventHandler smtpCli
341341 UseDefaultCredentials = false ,
342342 Credentials = new NetworkCredential ( UserName , Password ) ,
343343 } ;
344- using ( var message = new MailMessage ( new MailAddress ( @from ) , new MailAddress ( ToEmail ) ) { IsBodyHtml = true , Subject = subject , Body = CreateHtmlReport ( userMessage ) } )
344+
345+ using ( var message = new MailMessage ( new MailAddress ( FromEmail ) , new MailAddress ( ToEmail ) ) { IsBodyHtml = true , Subject = subject , Body = CreateHtmlReport ( userMessage ) } )
345346 {
346347 if ( ScreenShotBinary ? . Length > 0 && includeScreenshot )
347348 {
0 commit comments