public void SendMail(int SendByUserId, int SendToUserId, string Subject, string _EmailBody)
        {
            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;
            object[] _ParamMail = { _objMailMessage };
            UserInfoResource objUser = new UserInfoResource();

            if (objUser.SaveEmail(_ParamMail) > 0)
            {
                EmailMessages objEmail = EmailMessages.Instance;

                //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);
                if (objToUserInfo.EmailNotification.MessagesNotify)
                {
                    bool val = objEmail.SendMessages("Your " + WebConfig.ApplicationWord + " <" + WebConfig.NoreplyEmail + ">", objToUserInfo.Users.Email, GetEmailSubject(objFromUserInfo), GetEmailBody(objFromUserInfo, objToUserInfo, Subject, _EmailBody), EmailMessages.TextFormat.Html.ToString());
                }
            }
        }