Professional Applications Programmers/Consultants برمجة واستشارات تطبيقات الإنترنت
Skip Navigation LinksHome » Code Library » Mail

Public general use code classes and xml files that we've compiled and used over the years:

Mail process support class of Next Generation Network'a (NGN's) business model.

   1:  using System;
   2:  using System.Collections;
   3:  using System.Collections.Generic;
   4:  using System.Linq;
   5:  using System.Web;
   6:  using System.Web.Security;
   7:  using System.Text.RegularExpressions;
   8:  using System.Xml;
   9:  using System.Xml.Serialization;
  10:  using System.Text;
  11:  using System.IO;
  12:  using System.Configuration;
  13:   
  14:  namespace Ia.Ngn.Cl.Model.Business
  15:  {
  16:      ////////////////////////////////////////////////////////////////////////////
  17:   
  18:      /// <summary publish="true">
  19:      /// Mail process support class of Next Generation Network'a (NGN's) business model.
  20:      /// </summary>
  21:      /// 
  22:      /// <remarks> 
  23:      /// Copyright © 2006-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  24:      ///
  25:      /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
  26:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  27:      ///
  28:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  29:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  30:      /// 
  31:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  32:      /// 
  33:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  34:      /// </remarks> 
  35:      public partial class Mail
  36:      {
  37:          private bool serverEnableSsl;
  38:          private string serverHost, serverUser, serverPassword; //, defaultMailbox;
  39:          private Ia.Cl.Model.Imap imap;
  40:   
  41:          private List<string> mailboxList;
  42:          private List<string> mailRegexToMailboxList;
  43:   
  44:          /// <summary/>
  45:          public bool EnabledSsl { get; set; }
  46:          /// <summary/>
  47:          public bool IsActive { get; set; }
  48:          /// <summary/>
  49:          public bool IsActiveDuringWorkingHoursOnly { get; set; }
  50:          /// <summary/>
  51:          public int MailboxCheckFrequencyInMinutes { get; set; }
  52:          /// <summary/>
  53:          public string Host { get; set; }
  54:          /// <summary/>
  55:          public string UserName { get; set; }
  56:          /// <summary/>
  57:          public string Password { get; set; }
  58:          /// <summary/>
  59:          public List<string> MailboxList { get { return mailboxList; } }
  60:          /// <summary/>
  61:          public List<string> MailRegexToMailboxList { get { return mailRegexToMailboxList; } }
  62:   
  63:          ////////////////////////////////////////////////////////////////////////////
  64:   
  65:          /// <summary>
  66:          ///
  67:          /// </summary>
  68:          public Mail()
  69:          {
  70:              bool b;
  71:   
  72:              mailRegexToMailboxList = new List<string>(100);
  73:              mailboxList = new List<string>(100);
  74:   
  75:              serverHost = ConfigurationManager.AppSettings["imapServerHost"].ToString();
  76:              serverUser = ConfigurationManager.AppSettings["imapServerUser"].ToString();
  77:              serverPassword = ConfigurationManager.AppSettings["imapServerPassword"].ToString();
  78:              serverEnableSsl = bool.TryParse(ConfigurationManager.AppSettings["imapServerEnableSsl"].ToString(), out b) ? b : false;
  79:          }
  80:   
  81:          ////////////////////////////////////////////////////////////////////////////
  82:   
  83:          /// <summary>
  84:          ///
  85:          /// </summary>
  86:          public void Connect()
  87:          {
  88:              imap = new Ia.Cl.Model.Imap(serverHost, serverUser, serverPassword, serverEnableSsl);
  89:          }
  90:   
  91:          ////////////////////////////////////////////////////////////////////////////
  92:   
  93:          /// <summary>
  94:          ///
  95:          /// </summary>
  96:          public bool IsConnected
  97:          {
  98:              get
  99:              {
 100:                  return imap.IsConnected;
 101:              }
 102:          }
 103:   
 104:          ////////////////////////////////////////////////////////////////////////////
 105:   
 106:          /// <summary>
 107:          ///
 108:          /// </summary>
 109:          public void Disconnect()
 110:          {
 111:              imap.Disconnect();
 112:          }
 113:   
 114:          ////////////////////////////////////////////////////////////////////////////
 115:   
 116:          /// <summary>
 117:          ///
 118:          /// </summary>
 119:          public void InitializeMailboxes()
 120:          {
 121:              // Create Processed and Unprocessed folders if they don't already exist
 122:   
 123:              //bool b;
 124:              List<string> mailboxList;
 125:   
 126:              //b = false;
 127:   
 128:              try
 129:              {
 130:                  this.Connect();
 131:   
 132:                  if (this.IsConnected)
 133:                  {
 134:                      mailboxList = imap.MailboxList();
 135:   
 136:                      // below: determain change if any
 137:                      // below: mailboxes to add:
 138:                      if (!mailboxList.Contains("Processed")) imap.CreateMailbox("Processed");
 139:                      if (!mailboxList.Contains("Unprocessed")) imap.CreateMailbox("Unprocessed");
 140:   
 141:                      // below: read all mailboxes again
 142:                      mailboxList = imap.MailboxList();
 143:   
 144:                      //b = true;
 145:                  }
 146:   
 147:                  this.Disconnect();
 148:              }
 149:              catch (Exception)// ex)
 150:              {
 151:                  //b = false;
 152:   
 153:                  //result = ex.ToString();
 154:              }
 155:          }
 156:   
 157:          ////////////////////////////////////////////////////////////////////////////
 158:   
 159:          /// <summary>
 160:          ///
 161:          /// </summary>
 162:          public bool AddMailbox(string name, out string result)
 163:          {
 164:              bool b;
 165:              string s;
 166:   
 167:              if (Ia.Cl.Model.File.IsValidFilename(name))
 168:              {
 169:                  // below: check if the mailbox name exists in upper or lower forms
 170:                  s = (from m in mailboxList where m.ToLower() == name.ToLower() select m).SingleOrDefault();
 171:   
 172:                  if (s == null) // no duplicates
 173:                  {
 174:                      mailboxList.Add(name);
 175:   
 176:                      result = "Success: Mailbox name '" + name + "' assigned to be added. ";
 177:                      b = true;
 178:                  }
 179:                  else
 180:                  {
 181:                      result = "Error: Mailbox name '" + name + "' already assigned or exists. ";
 182:                      b = false;
 183:                  }
 184:              }
 185:              else
 186:              {
 187:                  result = "Error: Mailbox '" + name + "' is not valid. ";
 188:                  b = false;
 189:              }
 190:   
 191:              return b;
 192:          }
 193:   
 194:          ////////////////////////////////////////////////////////////////////////////
 195:   
 196:          /// <summary>
 197:          ///
 198:          /// </summary>
 199:          public bool DeleteMailbox(string name, out string result)
 200:          {
 201:              bool b;
 202:   
 203:              if (mailboxList.Contains(name) || mailboxList.Contains(name.ToLower()))
 204:              {
 205:                  mailboxList.Remove(name);
 206:   
 207:                  result = "Success: Mailbox name '" + name + "' assigned to be deleted. ";
 208:                  b = true;
 209:              }
 210:              else
 211:              {
 212:                  result = "Error: Mailbox name '" + name + "' does not exist. ";
 213:                  b = false;
 214:              }
 215:   
 216:              return b;
 217:          }
 218:   
 219:          ////////////////////////////////////////////////////////////////////////////
 220:   
 221:          /// <summary>
 222:          ///
 223:          /// </summary>
 224:          public void CopyMailboxList(List<string> newMailboxList)
 225:          {
 226:              // below: this will copy mailbox list into object
 227:   
 228:              mailboxList.Clear();
 229:   
 230:              foreach (string s in newMailboxList) mailboxList.Add(s);
 231:          }
 232:   
 233:          ////////////////////////////////////////////////////////////////////////////
 234:   
 235:          /// <summary>
 236:          ///
 237:          /// </summary>
 238:          public bool AddRegex(string mailboxName, string regex, out string result)
 239:          {
 240:              bool b;
 241:   
 242:              if (Ia.Cl.Model.Default.IsRegexPatternValid(regex))
 243:              {
 244:                  if (mailboxList.Contains(mailboxName) || mailboxList.Contains(mailboxName.ToLower()))
 245:                  {
 246:                      if (!mailRegexToMailboxList.Contains(regex + " (" + mailboxName + ")"))
 247:                      {
 248:                          mailRegexToMailboxList.Add(regex + " (" + mailboxName + ")");
 249:   
 250:                          result = "Success: Regex '" + regex + "' for mailbox '" + mailboxName + "' is added. ";
 251:                          b = true;
 252:                      }
 253:                      else
 254:                      {
 255:                          result = "Error: Regex '" + regex + "' for mailbox '" + mailboxName + "' already exists. ";
 256:                          b = false;
 257:                      }
 258:                  }
 259:                  else
 260:                  {
 261:                      result = "Error: Mailbox '" + mailboxName + "' is not assigned or does not exist. ";
 262:                      b = false;
 263:                  }
 264:              }
 265:              else
 266:              {
 267:                  result = "Error: Regex pattern '" + regex + "' is invalid. ";
 268:                  b = false;
 269:              }
 270:   
 271:              return b;
 272:          }
 273:   
 274:          ////////////////////////////////////////////////////////////////////////////
 275:   
 276:          /// <summary>
 277:          ///
 278:          /// </summary>
 279:          public bool DeleteRegex(string regex, out string result)
 280:          {
 281:              bool b;
 282:   
 283:              if (mailRegexToMailboxList.Contains(regex))
 284:              {
 285:                  mailRegexToMailboxList.Remove(regex);
 286:   
 287:                  result = "Success: regex '" + regex + "' was removed. ";
 288:                  b = true;
 289:              }
 290:              else
 291:              {
 292:                  result = "Error: regex does not exist. ";
 293:                  b = false;
 294:              }
 295:   
 296:              return b;
 297:          }
 298:   
 299:          ////////////////////////////////////////////////////////////////////////////
 300:          ////////////////////////////////////////////////////////////////////////////
 301:   
 302:          /// <summary>
 303:          ///
 304:          /// </summary>
 305:          public static Mail DeserializeFromString(string serializedObject)
 306:          {
 307:              Mail m;
 308:   
 309:              m = serializedObject.XmlDeserializeFromString<Mail>();
 310:   
 311:              return m;
 312:          }
 313:   
 314:          ////////////////////////////////////////////////////////////////////////////
 315:   
 316:          /// <summary>
 317:          ///
 318:          /// </summary>
 319:          public string SerializeToString()
 320:          {
 321:              StringBuilder sb;
 322:   
 323:              sb = new StringBuilder(10000);
 324:   
 325:              var serializer = new XmlSerializer(typeof(Mail));
 326:   
 327:              using (var writer = XmlWriter.Create(sb))
 328:              {
 329:                  serializer.Serialize(writer, this);
 330:              }
 331:   
 332:              return sb.ToString();
 333:          }
 334:   
 335:          ////////////////////////////////////////////////////////////////////////////
 336:   
 337:          /// <summary>
 338:          ///
 339:          /// </summary>
 340:          public static bool Sorter(Mail m, out Ia.Cl.Model.Result result)
 341:          {
 342:              bool b;
 343:              int numberOfMessagesMoved;
 344:              string regex, destinationMailbox; //, messageId, email;
 345:              List<string> mailboxList, mailboxesToDeleteList, mailboxesToAddList;
 346:              Hashtable mailRegexToMailboxHashtable, /*messageIdToFromEmailHashtable,*/ messageIdToDestinationMailboxHashtable;
 347:              Match match;
 348:              Ia.Cl.Model.Imap imap2;
 349:   
 350:              b = false;
 351:              numberOfMessagesMoved = 0;
 352:              result = new Ia.Cl.Model.Result();
 353:   
 354:              mailboxesToDeleteList = new List<string>(100);
 355:              mailboxesToAddList = new List<string>(100);
 356:              mailRegexToMailboxHashtable = new Hashtable(100);
 357:              messageIdToDestinationMailboxHashtable = new Hashtable(1000);
 358:   
 359:              try
 360:              {
 361:                  imap2 = new Ia.Cl.Model.Imap(m.Host, m.UserName, m.Password, m.EnabledSsl);
 362:                  //imap2 = new Ia.Cl.Model.Imap("imap.*.com", "*@*.com", "*", false);
 363:   
 364:                  imap2.Connect();
 365:   
 366:                  if (imap2.IsConnected)
 367:                  {
 368:                      // below: read all mailboxes
 369:                      mailboxList = imap2.MailboxList();
 370:   
 371:                      // below: determain change if any
 372:                      // below: mailboxes to add:
 373:                      foreach (string s in m.MailboxList) if (!mailboxList.Contains(s)) mailboxesToAddList.Add(s);
 374:   
 375:                      // below: mailboxes to delete:
 376:                      // below: I will disable deletion of mailboxes
 377:                      // foreach (string s in mailboxArrayList) if (!m.MailboxList.Contains(s)) mailboxesToAddArrayList.Add(s);
 378:   
 379:                      // below: create mailboxes
 380:                      foreach (string s in mailboxesToAddList) imap2.CreateMailbox(s);
 381:   
 382:                      // below: delete mailboxes
 383:                      // foreach (string s in mailboxesToDeleteArrayList) imap.DeleteMailbox(s);
 384:   
 385:                      // below: read all mailboxes again
 386:                      mailboxList = imap2.MailboxList();
 387:   
 388:                      // below: assign change to object
 389:                      m.CopyMailboxList(mailboxList);
 390:   
 391:                      // below: start moving
 392:                      foreach (string s in m.MailRegexToMailboxList)
 393:                      {
 394:                          match = Regex.Match(s, @"(.+?) \((.+?)\)");
 395:   
 396:                          if (match.Success)
 397:                          {
 398:                              regex = match.Groups[1].Value;
 399:                              destinationMailbox = match.Groups[2].Value;
 400:   
 401:                              numberOfMessagesMoved += imap2.MoveMessagesFromEmailToMailbox(regex, destinationMailbox);
 402:                          }
 403:                      }
 404:   
 405:                      imap2.Disconnect();
 406:   
 407:                      result.AddSuccess("Number of messages moved: " + numberOfMessagesMoved + ". ");
 408:   
 409:                      b = true;
 410:                  }
 411:                  else
 412:                  {
 413:   
 414:                  }
 415:              }
 416:              catch (Exception ex)
 417:              {
 418:                  b = false;
 419:   
 420:                  result.AddSuccess("Exception: " + ex.ToString());
 421:              }
 422:   
 423:              return b;
 424:          }
 425:   
 426:          /*
 427:  /////////////////////////////////////////////////////////////////////////////////
 428:  /////////////////////////////////////////////////////////////////////////////////
 429:  
 430:  /// <summary>
 431:  ///
 432:  /// </summary>
 433:  public int Isp_Mail(int isp_id, out string result)
 434:  {
 435:      int op, count;
 436:      string message, sql, from, to, sa; //, ni;
 437:      string name, name_ar, description, service_request_customer_id, email, subject;
 438:      StringBuilder sb;
 439:      DateTime now;
 440:      DataTable dt;
 441:  
 442:      op = 0;
 443:      count = 0;
 444:      result = new Ia.Cl.Model.Result();
 445:      sb = new StringBuilder(10000);
 446:  
 447:      / *
 448:      <isp id="1" name="Quality Net"
 449:      <isp id="2" name="FastTelco"
 450:      <isp id="3" name="UCC-United Networks"
 451:      <isp id="4" name="KEMS - Zajel"
 452:      * /
 453:  
 454:      now = DateTime.UtcNow.AddHours(3);
 455:  
 456:      name = hsi_xd.SelectSingleNode("hsi/isp/isp[@id='" + isp_id + "']").Attributes["name"].Value;
 457:      name_ar = hsi_xd.SelectSingleNode("hsi/isp/isp[@id='" + isp_id + "']").Attributes["name_ar"].Value;
 458:      description = hsi_xd.SelectSingleNode("hsi/isp/isp[@id='" + isp_id + "']").Attributes["description"].Value;
 459:      service_request_customer_id = hsi_xd.SelectSingleNode("hsi/isp/isp[@id='" + isp_id + "']").Attributes["service_request_customer_id"].Value;
 460:      email = hsi_xd.SelectSingleNode("hsi/isp/isp[@id='" + isp_id + "']").Attributes["email"].Value;
 461:  
 462:      // below: collecting information
 463:  
 464:      // Note:  if today is a Sunday, we will read information from the last week hours to cover HSI provisioning from last Thursday
 465:      if (now.DayOfWeek == DayOfWeek.Sunday)
 466:      {
 467:          subject = "List of Provisioned HSI During Last Working Week Hours Until <b>" + now.ToString("yyyy-MM-dd HH:mm") + "</b>";
 468:          from = "'" + now.AddHours(-24 * 7).ToString("yyyy-MM-ddTHH:mm:ss") + "'";
 469:      }
 470:      else
 471:      {
 472:          subject = "List of Provisioned HSI During Last Working 24 Hours Until <b>" + now.ToString("yyyy-MM-dd HH:mm") + "</b>";
 473:          from = "'" + now.AddHours(-24).ToString("yyyy-MM-ddTHH:mm:ss") + "'";
 474:      }
 475:  
 476:      to = "'" + now.ToString("yyyy-MM-ddTHH:mm:ss") + "'";
 477:  
 478:      sql = "sr.id, sr.service_id, sr.service_category_id, sr.status, sr.request_time, sr.customer_id, sr.customer_name, sr.customer_category_id, sr.customer_address, srt1.type_value AS sr_ont_id, srt2.type_value AS sr_ip, srt3.type_value AS sr_dn, srt4.type_value AS sr_customer_name, c.olt, c.olt_rack, c.olt_sub, c.olt_card, c.olt_port, h.port, h.updated FROM ia_service_request AS sr LEFT OUTER JOIN ia_service_request_type AS srt1 ON sr.id = srt1.ia_service_request_id AND srt1.type_id = 17 LEFT OUTER JOIN ia_service_request_type AS srt2 ON sr.id = srt2.ia_service_request_id AND srt2.type_id = 46 LEFT OUTER JOIN ia_service_request_type AS srt3 ON sr.id = srt3.ia_service_request_id AND srt3.type_id = 48 LEFT OUTER JOIN ia_service_request_type AS srt4 ON sr.id = srt4.ia_service_request_id AND srt4.type_id = 49 INNER JOIN ia_connection AS c ON c.ip = srt2.type_value INNER JOIN ia_hsi AS h ON h.ia_connection_id = c.id WHERE (sr.id IN (SELECT ia_service_request_id FROM ia_service_request_type AS srt WHERE (type_id = 48)    )) AND (sr.service_category_id = 49) AND (sr.request_time > " + from + " AND sr.request_time <= " + to + ")";
 479:  
 480:      dt = Ia.Cs.Db.SqlServer.StaticSelect(@"SELECT " + sql + " AND (customer_id = " + service_request_customer_id + ") ORDER BY sr.request_time, sr.id");
 481:  
 482:      foreach (DataRow dr in dt.Rows)
 483:      {
 484:          sa = dr["sr_ont_id"].ToString().PadRight(12, ' ') + "  " + dr["sr_dn"].ToString() + "  " + dr["port"].ToString().PadRight(5, ' ') + "  " + dr["updated"].ToString() + "\n";
 485:          sb.Append(sa);
 486:          count++;
 487:      }
 488:  
 489:      message = Ia.Ngn.Cs.This.Mail_Top();
 490:      message += @"
 491:  <p>" + subject + @".</p>
 492:  
 493:  <p><span style=""color:DarkRed"">Note</span>: This email is sent automatically. If you have requests or suggestions please email HSI support (<a href=mailto:hsi@moc.kw>hsi@moc.kw</a>)</p>
 494:  
 495:  <table cellspacing=""0"">
 496:  <tr><td><hr/></td></tr>
 497:  <tr>
 498:  <td valign=""top"">
 499:  <table class=""form"">
 500:  <tr><td style=""vertical-align:top;color:MediumSlateBlue"">ISP:</td><td style=""vertical-align:top;""><span style=""color:Olive"">" + name + @"</span> (" + name_ar + @")</td></tr>
 501:  <tr><td style=""vertical-align:top;color:MediumSlateBlue"">Description:</td><td style=""vertical-align:top;"">" + description + @"</td></tr>
 502:  <tr><td style=""vertical-align:top;color:MediumSlateBlue"">Email:</td><td style=""vertical-align:top;"">" + email + @"</td></tr>
 503:  </table>
 504:  </td>
 505:  </tr>
 506:  <tr><td><hr/></td></tr>
 507:  </table>
 508:  
 509:  <br/>";
 510:  
 511:      // below: remove last ' ' char
 512:      if (sb.Length > 0)
 513:      {
 514:          sb.Remove(sb.Length - 1, 1);
 515:  
 516:          message += "Total of <u>" + count + "</u> service requests provisioned";
 517:      }
 518:      else
 519:      {
 520:          message += "Total of 0 (zero) service requests provisioned";
 521:      }
 522:  
 523:      message += @"<pre style=""font-family:Courier New"">Location      Number   Port   Update" + "\n" + sb.ToString() + @"</pre>";
 524:      message += "<br/><br/><br/><br/>";
 525:  
 526:      message += Ia.Ngn.Cs.This.Mail_Bottom();
 527:  
 528:      result = new Ia.Cl.Model.Result();
 529:      Ia.Cs.Mail.Send_Html(name, email, subject, "k.alazmi@qualitynet.net,Khaled Al-Azmi;hsi@moc.kw,Ali Faia", message, out result);
 530:  
 531:      if (result == "") { result = "ISP Mail sent"; op = 1; }
 532:      else op = -1;
 533:  
 534:      return op;
 535:  }
 536:  */
 537:   
 538:          /*
 539:          /////////////////////////////////////////////////////////////////////////////////
 540:          /////////////////////////////////////////////////////////////////////////////////
 541:  
 542:          /// <summary>
 543:          ///
 544:          /// </summary>
 545:          public int Report_Mail(string email, string report_name, out string result)
 546:          {
 547:              int op;
 548:              string message, description;
 549:              string name, subject;
 550:              StringBuilder sb;
 551:              ArrayList al;
 552:              DateTime now;
 553:  
 554:              op = 0;
 555:              result = new Ia.Cl.Model.Result();
 556:              sb = new StringBuilder(10000);
 557:  
 558:              now = DateTime.UtcNow.AddHours(3);
 559:  
 560:              name = "NGN Staff";
 561:              description = "Attn: Customer Care Department";
 562:              subject = "List of Complete Address and Connection Information, of Ready ONTs as of " + now.ToString("yyyy-MM-dd HH:mm");
 563:  
 564:              // below: collecting information
 565:  
 566:              message = Ia.Ngn.Cs.This.Mail_Top();
 567:              message += @"
 568:  
 569:  <p>List of Complete Address and Connection Information, of Ready ONTs as of <b>" + now.ToString("yyyy-MM-dd HH:mm") + @"</b> This report does not contain any parameters sent in previous reports.</p>
 570:  
 571:  <p><span style=""color:DarkRed"">Note</span>: This email is sent automatically. If you have requests or suggestions please email support (<a href=mailto:hsi@moc.kw>hsi@moc.kw</a>)</p>
 572:  
 573:  <table cellspacing=""0"">
 574:  <tr><td><hr/></td></tr>
 575:  <tr>
 576:  <td valign=""top"">
 577:  <table class=""form"">
 578:  <tr><td style=""vertical-align:top;color:MediumSlateBlue"">Name:</td><td style=""vertical-align:top;""><span style=""color:Olive"">" + name + @"</span></td></tr>
 579:  <tr><td style=""vertical-align:top;color:MediumSlateBlue"">Description:</td><td style=""vertical-align:top;"">" + description + @"</td></tr>
 580:  <tr><td style=""vertical-align:top;color:MediumSlateBlue"">Email:</td><td style=""vertical-align:top;"">" + email + @"</td></tr>
 581:  <tr><td style=""vertical-align:top;color:MediumSlateBlue"">Report:</td><td style=""vertical-align:top;"">" + report_name.Replace("report_file ", "") + @"</td></tr>
 582:  </table>
 583:  </td>
 584:  </tr>
 585:  <tr><td><hr/></td></tr>
 586:  </table>
 587:  
 588:  <br/>";
 589:  
 590:              message += @"<pre style=""font-family:Courier New"">Location" + "\n";
 591:  
 592:              Ia.Cs.Db.SqlServer.Misc_Select(report_name, out al);
 593:  
 594:              foreach (string s in al)
 595:              {
 596:                  sb.Append(s + "\n");
 597:              }
 598:  
 599:              message += sb.ToString();
 600:  
 601:              message += @"</pre>";
 602:              message += "<br/><br/><br/><br/>";
 603:  
 604:              message += Ia.Ngn.Cs.This.Mail_Bottom();
 605:  
 606:              result = new Ia.Cl.Model.Result();
 607:              Ia.Cs.Smtp.Send_Html(name, email, subject/*, "k.alazmi@qualitynet.net,Khaled Al-Azmi;hsi@moc.kw,Ali Faia"* /, message, out result);
 608:  
 609:              if (result == "") { result = "Mail sent"; op = 1; }
 610:              else op = -1;
 611:  
 612:              return op;
 613:          }
 614:           */
 615:   
 616:          ////////////////////////////////////////////////////////////////////////////
 617:          ////////////////////////////////////////////////////////////////////////////
 618:      }
 619:   
 620:      ////////////////////////////////////////////////////////////////////////////
 621:      ////////////////////////////////////////////////////////////////////////////
 622:  }