Example #1
0
 public void TearDownEnvironment()
 {
     new Common().CloseProcess("chromedriver");
     extentReport.EndReport();
     new CommonFeatures().ZipFolder();
     //new Common().CloseProcess("Caffeine");
     MailReport.SendMail();
 }
Example #2
0
        // Report non-delivery report
        private void ShowReport(string fileName)
        {
            try
            {
                Mail oMail = new Mail("TryIt");
                oMail.Load(fileName, false);

                if (!oMail.IsReport)
                {
                    MessageBox.Show("This is not a report");
                    return;
                }

                string     s       = "";
                MailReport oReport = oMail.GetReport();
                switch (oReport.ReportType)
                {
                case DeliveryReportType.DeliveryReceipt:
                    s = "This is a deliver receipt.\r\n\r\n";
                    break;

                case DeliveryReportType.ReadReceipt:
                    s = "This is a read receipt.\r\n\r\n";
                    break;

                default:
                    s = "This is a failure report.\r\n\r\n";
                    break;
                }

                s += String.Format("Original Sender: {0}\r\n", oReport.OriginalSender);
                s += String.Format("Original Recipient: {0}\r\n", oReport.OriginalRecipient);
                s += String.Format("Original Message-ID: {0}\r\n\r\n", oReport.OriginalMessageID);

                if (oReport.ReportType == DeliveryReportType.FailureReport)
                {
                    s += String.Format("Original Subject: {0}\r\n", oReport.OriginalSubject);
                    s += String.Format("Report MTA: {0}\r\n", oReport.ReportMTA);
                    s += String.Format("Error Code: {0}\r\n", oReport.ErrCode);
                    s += String.Format("Error Description: {0}\r\n\r\n", oReport.ErrDescription);

                    s += "---- Original Message Header ----\r\n\r\n";
                    HeaderCollection oHeaders = oReport.OriginalHeaders;
                    int count = oHeaders.Count;
                    for (int i = 0; i < count; i++)
                    {
                        HeaderItem oHeader = oHeaders[i] as HeaderItem;
                        s += String.Format("{0}: {1}\r\n", oHeader.HeaderKey, oHeader.HeaderValue);
                    }
                }

                textReport.Text = s;
            }
            catch (Exception ep)
            {
                MessageBox.Show(ep.Message);
            }
        }
Example #3
0
        public JsonResult SendMail(string reportLocation)
        {
            var          mail   = new MailReport();
            MethodStatus status = new MethodStatus();

            if (string.IsNullOrWhiteSpace(reportLocation))
            {
                status.success = false;
            }
            else
            {
                status.success = mail.SendReport(reportLocation);
            }

            return(Json(status, JsonRequestBehavior.DenyGet));
        }
Example #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //
            // If the user is not loggedin, redirect to Login page.
            if (HttpContext.Current.Session == null || HttpContext.Current.Session.Contents["UserData"] == null)
            {
                string RedirectTo = String.Format(@"{0}/User/Dashboard", Global.APPLICATION_URL);
                string Url        = String.Format(@"{0}/Login?RedirectTo={1}", Global.APPLICATION_URL, RedirectTo);
                Response.Redirect(Url);
            }
            else
            {
                CurrentSession = ((UserSession)HttpContext.Current.Session.Contents["UserData"]);
                if (CurrentSession.ActiveRoleName != Functions.NormalUserRoleName && CurrentSession.ActiveRoleName != Functions.UserDelegeeRoleName)
                {
                    string url = String.Format(@"{0}/Authorize?access={1}", Global.APPLICATION_URL, CurrentSession.ActiveRoleName);
                    Response.Redirect(url);
                }
            }

            //initialize the local copy of the current user's PrimarySipAccount
            sipAccount = CurrentSession.GetEffectiveSipAccount();

            //Get the display name for this user
            DisplayName = CurrentSession.GetEffectiveDisplayName();

            //Initialize the Address Book data.
            CurrentSession.FetchSessionPhonecallsAndAddressbookData(out userSessionPhoneCalls, out userSessionAddressbook);

            //Get this user's mail statistics
            userMailStatistics = Global.DATABASE.MailReports.GetTotalByUser(sipAccount, DateTime.Now.AddMonths(-1));

            //Try to auto-mark phonecalls using the user's addressbook
            //Return the number of still-unmarked phone calls
            unmarkedCallsCount = TryAutoMarkPhoneCalls();
        }
Example #5
0
        private void _showReport(string fileName)
        {
            try
            {
                Mail mail = new Mail("TryIt");
                mail.Load(fileName, false);

                if (!mail.IsReport)
                {
                    MessageBox.Show("This is not a report");
                    return;
                }

                string     s      = "";
                MailReport report = mail.GetReport();
                switch (report.ReportType)
                {
                case DeliveryReportType.DeliveryReceipt:
                    s = "This is a deliver receipt.\r\n\r\n";
                    break;

                case DeliveryReportType.ReadReceipt:
                    s = "This is a read receipt.\r\n\r\n";
                    break;

                case DeliveryReportType.Deleted:
                    s = "This is a unread receipt, this email was deleted without read.\r\n\r\n";
                    break;

                case DeliveryReportType.DelayedReport:
                    s = "This is a delay report, this email will be retried later automatically.\r\n\r\n";
                    break;

                default:
                    s = "This is a failure report.\r\n\r\n";
                    break;
                }

                s += string.Format("Original Sender: {0}\r\n", report.OriginalSender);
                s += string.Format("Original Recipient: {0}\r\n", report.OriginalRecipient);
                s += string.Format("Original Message-ID: {0}\r\n\r\n", report.OriginalMessageID);

                if (report.ReportType == DeliveryReportType.FailureReport || report.ReportType == DeliveryReportType.DelayedReport)
                {
                    s += string.Format("Original Subject: {0}\r\n", report.OriginalSubject);
                    s += string.Format("Report MTA: {0}\r\n", report.ReportMTA);
                    s += string.Format("Error Code: {0}\r\n", report.ErrCode);
                    s += string.Format("Error Description: {0}\r\n\r\n", report.ErrDescription);

                    s += "---- Original Message Header ----\r\n\r\n";
                    HeaderCollection headers = report.OriginalHeaders;
                    int count = headers.Count;
                    for (int i = 0; i < count; i++)
                    {
                        HeaderItem header = headers[i] as HeaderItem;
                        s += string.Format("{0}: {1}\r\n", header.HeaderKey, header.HeaderValue);
                    }
                }

                textReport.Text = s;
            }
            catch (Exception ep)
            {
                MessageBox.Show(ep.Message);
            }
        }