예제 #1
0
        private void ReplyMail()
        {
            if (_IsReply)
            {
                ComposeMail replycompose = new ComposeMail(SpeechToText.ComposeMail.Mailtype.ReplyMail, _fromEmail, _Subject, _Message, 0);
                replycompose.ShowDialog();
                return;
            }
            // this.Close();
            List <Form> forms = new List <Form>();

            // All opened myForm instances
            foreach (Form f in Application.OpenForms)
            {
                if (f.Name != "Mailbox")
                {
                    forms.Add(f);
                }
            }


            // Now let's close opened myForm instances
            foreach (Form f in forms)
            {
                f.Hide();
            }



            ComposeMail _composeMailForm = new ComposeMail(SpeechToText.ComposeMail.Mailtype.ReplyMail, _fromEmail, _Subject, _Message, 0);

            _composeMailForm.ShowDialog();
            this.Close();
        }
 public static void MessageQueue()
 {
     Message[] messages = msmq.ReceiveMsg();
     foreach (Message message in messages)
     {
         message.Formatter = new XmlMessageFormatter(new Type[] { typeof(ComposeMail) });
         ComposeMail composeMail = (ComposeMail)message.Body;
         NotifyThroughMail(composeMail.email, composeMail.message, composeMail.email);
     }
 }
        public ActionResult Compose(ComposeMail newMessage)
        {
            if (Request["Send"] != null)
            {
                if (ModelState.IsValid)
                {
                    // actually send it this time
                    try
                    {
                        EmailUtils.Send(newMessage.MailMessage);
                    }
                    catch
                    {
                        // there was an error sending the message
                        throw new HttpException(500, Support.Error_Sending);
                    }

                    try
                    {
                        if (!string.IsNullOrEmpty(newMessage.Uid))
                        {
                            using (var imap = EnsureConnection())
                            {
                                imap.SelectMailbox("Sent Items");
                                imap.AppendMail(newMessage.MailMessage);
                                imap.SelectMailbox("Drafts");
                                imap.DeleteMessage(newMessage.Uid);
                            }
                        }
                    }
                    catch
                    {
                        throw new HttpException(417, Support.Error_Copying);
                    }
                    return(new EmptyResult());
                }
                else
                {
                    Response.StatusCode             = 417;
                    Response.TrySkipIisCustomErrors = true;

                    return(PartialView(newMessage));
                }
            }
            else
            {
                newMessage.Uid = Draft(newMessage.MailMessage, newMessage.Uid).Uid;
                return(Json(newMessage));
            }
        }
 /// <summary>
 /// This function is used for releasing allocated resources.
 /// </summary>
 internal void ReleaseMemory()
 {
     this.objInstallMsn.Dispose();
     this.objInstallMsn = null;
     this.objCommon.Dispose();
     this.objCommon           = null;
     this.objExecuteInstaller = null;
     this.objExistingUserSignIn.Dispose();
     this.objExistingUserSignIn = null;
     this.objSignOut.Dispose();
     this.objSignOut = null;
     this.objComposeMail.Dispose();
     this.objComposeMail = null;
 }
 /// <summary>
 /// This function is used for releasing allocated resources.
 /// </summary>
 internal void ReleaseMemory()
 {
     this.objCommon.Dispose();
     this.objCommon = null;
     this.objComposeMail.Dispose();
     this.objComposeMail = null;
     this.objMsnInstallNewUserMediumDoNotRestart.Dispose();
     this.objMsnInstallNewUserMediumDoNotRestart = null;
     this.objExecuteMSI       = null;
     this.objExecuteInstaller = null;
     this.objExistingUserSignIn.Dispose();
     this.objExistingUserSignIn = null;
     this.objSignOut.Dispose();
     this.objSignOut = null;
 }
예제 #6
0
        public void  CompleteRegistration(Employee newEmp)
        {
            using (PsiogEntities PE = new PsiogEntities())
            {
                string VerificationCode = Guid.NewGuid().ToString();
                //var link = HttpContext.Current.Request.Url.AbsoluteUri + "/VerifyAccount?id=" + newEmp.EmployeeId;
                string encodedId = Hasher.EncodeId(newEmp.EmployeeId);
                var    link      = "http://*****:*****@gmail.com", VerificationCode, out SmtpClient messenger);
                var    account   = PE.Users.Where(a => a.EmployeeId == newEmp.EmployeeId).FirstOrDefault();


                mail.Body += link + ">Click here to complete registration</a>";
                messenger.Send(mail);
                messenger.Dispose();
            }
        }
예제 #7
0
        public IHttpActionResult GetResetLink(ForgotPassword resetter)
        {
            using (PsiogEntities PE = new PsiogEntities())
            {
                string VerificationCode = Guid.NewGuid().ToString();
                string encodedId        = Hasher.EncodeId(resetter.employeeId);
                var    link             = "http://localhost:4200/verify-employee/" + Hasher.EncodeId(resetter.employeeId);

                var result = PE.Users.Where(u => u.EmployeeId == resetter.employeeId).FirstOrDefault();

                if (result != null)
                {
                    if (string.Compare(result.Answer, resetter.answer) == 0)
                    {
                        var employee = PE.Employees.Where(u => u.EmployeeId == resetter.employeeId).FirstOrDefault();
                        result.VerificationCode = VerificationCode;
                        try
                        {
                            PE.SaveChanges();
                        }
                        catch (Exception E)
                        {
                            ExceptionLog.Logger(E);
                            return(Ok("Unable to get reset link"));
                        }
                        var mail = ComposeMail.SendResetLink(employee.Email, out SmtpClient messenger);

                        mail.Body += link + ">Click here to reset password</a>";
                        messenger.Send(mail);
                        messenger.Dispose();
                        return(Ok("Reset link has been sent to your registered email ID"));
                    }

                    else
                    {
                        return(Ok("Incorrect answer for security question"));
                    }
                }

                else
                {
                    return(Ok("Employee Id does not exist!"));
                }
            }
        }
        public void Compose(ComposeMail command)
        {
            var mail = new Mail
            {
                Id             = 1,
                Subject        = command.Subject,
                Message        = command.Message,
                Sender         = command.Sender,
                Receiver       = command.Receiver,
                HasAttachments = false,
                IsDeleted      = false,
                IsRead         = false,
                SendDate       = DateTime.Now
            };

            //mail.CheckSomething(command.Sender, command.Receiver);
            _mailRepository.Create(mail);
        }
        public ActionResult Compose(string uid)
        {
            if (string.IsNullOrEmpty(uid))
            {
                var msg = new ComposeMail();

                msg.To = SharedRes.Formats.MailAddress.FormatWith(new MailAddress("*****@*****.**", "Support"));

                return(PartialView(msg));
            }
            else
            {
                using (var imap = EnsureConnection())
                {
                    imap.SelectMailbox("Drafts");
                    var newMessage = imap.GetMessage(uid, false, true);
                    return(PartialView(new ComposeMail(newMessage)));
                }
            }
        }
 public void Post([FromBody] ComposeMail command)
 {
     _mailApplication.Compose(command);
 }
예제 #11
0
        private void GenerateForwardMail()
        {
            ComposeMail _composeMail = new ComposeMail(ComposeMail.Mailtype.ForwardMail, "", lblSubject.Text, txtMsg.Text, 0);

            _composeMail.Show();
        }