protected override void OnExecute(BackgroundWorker backgroundWorker) { body = "This is a log archive submitted by the FieldLog submit tool."; MessageApi mapi = new MessageApi(); mapi.AddRecipientTo(RecipientAddress); mapi.AddAttachment(SharedData.Instance.ArchiveFileName); bool result; if (SharedData.Instance.InteractiveEMail) { result = mapi.SendMailInteractive(Subject, body); } else { result = mapi.SendMailDirect(Subject, body); } if (backgroundWorker.CancellationPending) { return; } if (!result) { string x64Note = ""; if (IntPtr.Size == 8) { x64Note = " " + Tx.T("msg.error.mapi x64"); } string mapiError = "MAPI: " + mapi.LastError + "." + x64Note; if (mapi.LastError == MessageApi.MessageApiError.GeneralFailure && IsOutlookAvailable()) { try { SendWithOutlookDynamic(); } catch (Exception ex) { throw new Exception(mapiError + " " + Tx.T("msg.error.outlook fallback failed") + " " + ex.Message); } } else { throw new Exception(mapiError); } } }