Ejemplo n.º 1
0
        public bool Connect(cConnDetails connDetails)
        {
            string _stage = "";

            try
            {
                //
                _stage    = "Creating credentials";
                pExchange = new ExchangeService
                {
                    Credentials = new WebCredentials(connDetails.User, connDetails.Password)
                };
                //
                _stage = "Using credentials";
                System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;
                //
                _stage = "Connecting to exchange";
                //pExchange.Url = new System.Uri("https://exchange.espackeuro.com/ews/exchange.asmx");
                pExchange.Url = new System.Uri(connDetails.Server);
            }
            catch (Exception ex)
            {
                throw new Exception($"[cExchangeTools/Connect#{_stage}] {ex.Message}");
            }
            return(true);
        }
Ejemplo n.º 2
0
 public cEmail(cConnDetails connDetails, string recipients = null, string subject = null, string body = null, string attachment = null, string emptyMessage = null, bool error = false)
 {
     ConnDetails  = connDetails;
     Recipients   = recipients;
     Subject      = subject;
     Body         = body;
     Attachment   = attachment;
     EmptyMessage = emptyMessage;
     Error        = error;
 }