Ejemplo n.º 1
0
        private Evento prepareDetailsView(int?id, string errorPagoMsg)
        {
            ErrorEmail errorEmail = TempData["errorEmail"] != null
                ? (ErrorEmail)TempData["errorEmail"] : new ErrorEmail();

            Evento res = db.eventos.Find(id);

            ViewBag.errorMail      = errorEmail;
            ViewBag.errorPagoMsg   = errorPagoMsg;
            ViewBag.correoSettings = db.Correos.FirstOrDefault();

            return(res);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This is the validation oF Email at leave Event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void txtEmail_Leave(object sender, EventArgs e)
        {
            string pattren = @"^([\w\d.]+)@((\w+\.\w+)(\.\w+\.?)?)";

            //string pattren = "";
            if (Regex.IsMatch(txtEmail.Text, pattren))
            {
                ErrorEmail.Clear();
            }
            else
            {
                ErrorEmail.SetError(txtEmail, "Invalid Email");
            }
        }
Ejemplo n.º 3
0
         // cleanup here when messages are drained
         // If the timer is declared in a long-running method, use
         // KeepAlive to prevent garbage collection from occurring
         // before the method ends.
         //GC.KeepAlive(aTimer);        }
 
     private static void OnTimedEvent(object source, ElapsedEventArgs e) 
     {
         object errorEmail = null;
         lock (errors)
         {
             if (errors.Count > trigger)
             {
                // init message to contain errors here
                errorEmail = new ErrorEmail();
                foreach (string err in errors)
                {
                   // add error info to message
                } 
                errors.Clear();
                trigger = 0;
             }
         }
         if (errorEmail != null)
         {
           // send message outside the lock
           Send(errorEmail);
         }
     }
Ejemplo n.º 4
0
        //public ErrorEmail enviarCorreo(HttpPostedFileBase fileUploader, string emailDestino)
        public ErrorEmail enviarCorreo(string emailDestino, string clientName, Stream fileStream, string fileName, string aditionalBody)
        {
            ErrorEmail err = new ErrorEmail();

            try {
                MailMessage mail = new MailMessage(new MailAddress(this.correoAdmin, "Jerry's System"), new MailAddress(emailDestino, clientName));
                mail.Bcc.Add(new MailAddress("*****@*****.**", "Desarrollador"));
                //mail.Bcc.Add(new MailAddress("*****@*****.**", "Propietario"));

                if (fileStream != null)
                {
                    mail.Attachments.Add(new Attachment(fileStream, fileName));
                }

                mail.Subject    = this.Subject;
                mail.Body       = this.Body;
                mail.Body      += aditionalBody != null ? aditionalBody : string.Empty;
                mail.IsBodyHtml = false;
                SmtpClient smtp = new SmtpClient();

                /*smtp.Host = this.smtpHost;
                 * smtp.EnableSsl = this.sslEnabled;
                 * NetworkCredential networkCredential = new NetworkCredential(this.correoAdmin, this.contrasena);
                 * smtp.UseDefaultCredentials = false;
                 * smtp.Credentials = networkCredential;
                 * smtp.Port = this.puertoCorreo;*/
                smtp.Send(mail);
                err.code = ErrorEmail.ErrorEmailCode.SENT;
            }catch (Exception exc)
            {
                err.code = ErrorEmail.ErrorEmailCode.FAIL;
                err.msg  = exc.Message;
            }

            return(err);
        }
Ejemplo n.º 5
0
        private void ErrorSendMailBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                string      userEmail = (ErrorEmail != null && ErrorEmail.Length > 0 && ErrorEmail.IndexOf("@") != -1) ? ErrorEmail : "*****@*****.**";
                MailMessage message   = new MailMessage(userEmail, "*****@*****.**");
                string      subject   = "";

                try
                {
                    subject = String.Format("MOG({0}) {1}", AssemblyVersion, EventVerboseDescription);
                    if (subject.Length > 250)
                    {
                        subject = subject.Substring(0, 255);
                    }
                    if (subject.Contains("\n"))
                    {
                        subject = subject.Replace("\n", " ");
                    }
                    message.Subject = subject;
                }
                catch (Exception ex)
                {
                    try
                    {
                        ex.ToString();
                        subject         = String.Format("MOG({0})", AssemblyVersion);
                        message.Subject = subject;
                    }
                    catch
                    {
                        message.Subject = "MOG Event";
                    }
                }

                message.Body = FormatErrorMessage();

                SmtpClient client = new SmtpClient("mail.mogware.com");
                client.Credentials    = new NetworkCredential("*****@*****.**", "J3RKK");
                client.DeliveryMethod = SmtpDeliveryMethod.Network;

                client.Send(message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Send Email");
            }
        }