public void SendMailReply(int SendByUserId, int SendToUserId, string Subject, string _EmailBody, int Messageid)
        {
            EmailMessages objEmail = EmailMessages.Instance;
            //string fromMail = GetEmail(SendByUserId);
            //string tomail = GetEmail(SendToUserId);
            //bool val = objEmail.SendMessages(fromMail, tomail, Subject, _EmailBody, EmailMessages.TextFormat.Html.ToString());.

            //to get user details of from user id
            UserRegistration objFromUserInfo = new UserRegistration();
            objFromUserInfo = (UserRegistration)GetUserDetails(SendByUserId);
            //to get user details of TO user id
            UserRegistration objToUserInfo = new UserRegistration();
            objToUserInfo = (UserRegistration)GetUserDetails(SendToUserId);

            bool val = objEmail.SendMessages("Your " + WebConfig.ApplicationWord + " <" + WebConfig.NoreplyEmail + ">", objToUserInfo.Users.Email, GetEmailSubject(objFromUserInfo), GetEmailBody(objFromUserInfo, objToUserInfo, Subject, _EmailBody), EmailMessages.TextFormat.Html.ToString());

            MailMessage _objMailMessage = new MailMessage();
            _objMailMessage.SendByUserId = SendByUserId;
            _objMailMessage.Subject = Subject;
            _objMailMessage.Body = _EmailBody;
            _objMailMessage.SendToUserId = SendToUserId;
            _objMailMessage.SendDate = DateTime.Now;
            _objMailMessage.Status = 1;
            _objMailMessage.RecievedDate = DateTime.Now;
            _objMailMessage.CreatedBy = SendByUserId;
            _objMailMessage.CreatedDate = DateTime.Now;
            _objMailMessage.ModifiedBy = SendByUserId;
            _objMailMessage.ModifiedDate = DateTime.Now;
            _objMailMessage.IsActive = true;
            _objMailMessage.IsDeleted = false;
            _objMailMessage.MessageId = Messageid;
            object[] _ParamMail = { _objMailMessage };
            UserInfoResource objUser = new UserInfoResource();
            objUser.SaveEmailReply(_ParamMail);
        }