Example #1
0
        private string ClassifyMail(string Body)
        {
            string strmailtype = "None";

            try
            {
                if (Getpostion(Body, "From:") != -1)
                {
                    EmailType   = CreateRequest(Body);
                    strmailtype = EmailType.Replace("\r\n", string.Empty);
                    //Console.WriteLine(EmailType);
                }
                else
                {
                    string fileName = string.Format(PythonFilePath + " \"" + "{0}" + " \"" + " \"" + "{1}" + " \"" + " \"" + "{2}" + " \"", JSONFilePath, CSVFilePath, Body);
                    EmailType   = run_Python(fileName);
                    strmailtype = EmailType.Replace("\r\n", string.Empty);
                    //Console.WriteLine(EmailType);
                }
            }
            catch (Exception ex)
            {
                ErrCode  = 206;
                ErrDesc += "Message: " + ex.Message + Environment.NewLine + "Inner Exception: " + ex.InnerException + Environment.NewLine;

                Message = "Inside ClassifyMail() Exception: Error While Classifying Email. " + ex.Message;
                throw;
            }
            return(strmailtype);
        }