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) UI 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.Ui
  15:  {
  16:      ////////////////////////////////////////////////////////////////////////////
  17:   
  18:      /// <summary publish="true">
  19:      /// Mail process support class of Next Generation Network'a (NGN's) UI 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:          ////////////////////////////////////////////////////////////////////////////
  38:   
  39:          /// <summary>
  40:          ///
  41:          /// </summary>
  42:          public Mail()
  43:          {
  44:          }
  45:   
  46:          /////////////////////////////////////////////////////////////////////////////////
  47:   
  48:          /// <summary>
  49:          ///
  50:          /// </summary>
  51:          public static void Test(Ia.Ngn.Cl.Model.Business.Administration.StaffContact staffContact, string subject, string bodyText, out string responseSubject, out string responseContent)
  52:          {
  53:              DateTime now;
  54:   
  55:              now = DateTime.UtcNow.AddHours(3);
  56:   
  57:              responseSubject = "Test (" + now.ToString("yyyy-MM-dd HH:mm") + ")";
  58:   
  59:              responseContent = "Test: Daily Next Generation Network OFN Status Report: " + now.ToString("yyyy-MM-dd HH:mm") + "\r\n"
  60:                  + "Status: undefined.\r\n"
  61:                  + @"For help send ""help"" in a direct message." + "\r\n";
  62:          }
  63:   
  64:          /////////////////////////////////////////////////////////////////////////////////
  65:   
  66:          /// <summary>
  67:          ///
  68:          /// </summary>
  69:          public static void SendPlainMail(string name, string email, string subject, string content, out Ia.Cl.Model.Result result)
  70:          {
  71:              bool b;
  72:              string message, result2;
  73:   
  74:              result = new Ia.Cl.Model.Result();
  75:   
  76:              message = Ia.Ngn.Cl.Model.Ui.Default.PlainMailTop();
  77:   
  78:              message += content;
  79:   
  80:              message += Ia.Ngn.Cl.Model.Ui.Default.PlainMailBottom();
  81:   
  82:   
  83:              b = global::Ia.Cl.Model.Smtp.SendPlain(name, email, subject, message); //, out result2);
  84:   
  85:              if (b) result.AddSuccess("Email sent. ");
  86:              else result.AddError("Email was not send:"); // + result2);
  87:          }
  88:   
  89:          /////////////////////////////////////////////////////////////////////////////////
  90:   
  91:          /// <summary>
  92:          ///
  93:          /// </summary>
  94:          public static bool SendMail(string name, string email, string subject, string content, out string result)
  95:          {
  96:              bool b;
  97:              string message;
  98:   
  99:              message = Ia.Ngn.Cl.Model.Ui.Default.MailTop();
 100:   
 101:              message += content;
 102:   
 103:              message += Ia.Ngn.Cl.Model.Ui.Default.MailBottom();
 104:   
 105:              result = "";
 106:   
 107:              b = global::Ia.Cl.Model.Smtp.SendHtml(name, email, subject, message); //, out result);
 108:   
 109:              if (b) result = "Email sent. ";
 110:              else result = "Email was not send: " + result;
 111:   
 112:              return b;
 113:          }
 114:   
 115:          ////////////////////////////////////////////////////////////////////////////
 116:          ////////////////////////////////////////////////////////////////////////////
 117:      }
 118:   
 119:      ////////////////////////////////////////////////////////////////////////////
 120:      ////////////////////////////////////////////////////////////////////////////
 121:  }