public string GetLoggedInUserInfo(string UserEmailId) { UserApplicant objapp = new UserApplicant(); using (AIMFinServDBEntities db = new AIMFinServDBEntities()) { var fetchLoggedInUserInfo = (from tu in db.tblUsers join ta in db.tblApplicants on tu.Email equals ta.EmailID join tmf in db.tblMasterFileTypes on ta.FileTypeID equals tmf.ID where tu.Email == UserEmailId select new UserApplicant { Title = ta.Title, ApplicantID = ta.ApplicantID, FirstName = ta.FirstName, MiddleName = ta.MiddleName, LastName = ta.LastName, EmailID = ta.EmailID, ApplicantImage = ta.ApplicantImage, DisplayName = tu.DisplayName, Mobile = tu.Mobile, Email = tu.Email, Password = tu.Password, LastLoggedOn = tu.LastLoggedOn, ActivaitonCode = tu.ActivaitonCode, Description = tu.Description, FileType = tmf.FileType, }).FirstOrDefault(); return(JsonConvert.SerializeObject(fetchLoggedInUserInfo)); } }
public bool LoggedOffUser(string ActivationCode, bool IsLoggedIn) { using (AIMFinServDBEntities db = new AIMFinServDBEntities()) { string activationcode = ActivationCode.ToString(); var getuserdetails = db.tblUsers.Where(p => p.ActivaitonCode == activationcode && p.IsLoggedIn == true).FirstOrDefault(); if (getuserdetails != null) { getuserdetails.IsLoggedIn = false; getuserdetails.ActivaitonCode = string.Empty; db.SaveChanges(); } return(true); } }
//get all files from Google Drive. public List <GoogleDrive> GetDriveFiles(Guid ApplicantID) { try { using (AIMFinServDBEntities db = new AIMFinServDBEntities()) { var GetApplicantDetails = db.tblApplicants.Where(p => p.IsActive == true && p.ApplicantID == ApplicantID).FirstOrDefault(); List <GoogleDrive> FileList = new List <GoogleDrive>(); if (GetApplicantDetails != null) { DriveService service = GetService(); // define parameters of request. FilesResource.ListRequest FileListRequest = service.Files.List(); FileListRequest.Fields = "nextPageToken, files(id, name, size, version, createdTime)"; //get file list. IList <Google.Apis.Drive.v3.Data.File> files = FileListRequest.Execute().Files; if (files != null && files.Count > 0) { foreach (var file in files) { if (file.Size != null) { GoogleDrive File = new GoogleDrive { Id = file.Id, Name = file.Name, Size = file.Size, Version = file.Version, CreateTime = file.CreatedTime }; FileList.Add(File); } } } } return(FileList); } } catch (Exception ex) { return(null); } }
private string LoggedInUser(string UserEmailId, string password) { using (AIMFinServDBEntities db = new AIMFinServDBEntities()) { string strActcode = string.Empty; var getusrdetails = db.tblUsers.Where(p => p.Email.ToLower() == UserEmailId.ToLower() && p.Password.ToLower() == password.ToLower()).FirstOrDefault(); if (getusrdetails != null) { getusrdetails.IsLoggedIn = true; getusrdetails.LastLoggedOn = DateTime.Now; strActcode = Guid.NewGuid().ToString().Substring(0, 7); getusrdetails.ActivaitonCode = strActcode; db.SaveChanges(); } return(strActcode); } }
public bool AddLoanMasterDetails(LoanMasterDetails _objLoanMasterDetails) { try { using (AIMFinServDBEntities db = new AIMFinServDBEntities()) { if (_objLoanMasterDetails != null) { Guid LoanAppnoGuid = db.tblLoanApplicationForms.Single(x => x.AutoID == _objLoanMasterDetails.AutoID).LoanApplicationNo; tblLoanMaster _tblLoanMaster = new tblLoanMaster(); _tblLoanMaster.LANNumber = Guid.NewGuid(); _tblLoanMaster.LoanApplicationNo = LoanAppnoGuid; _tblLoanMaster.PropertyTypeID = _objLoanMasterDetails.PropertyTypeID; _tblLoanMaster.StatusID = _objLoanMasterDetails.StatusID; _tblLoanMaster.LoanTypeID = _objLoanMasterDetails.LoanTypeID; _tblLoanMaster.ClientID = _objLoanMasterDetails.ClientID; _tblLoanMaster.ROIOffered = _objLoanMasterDetails.ROIOffered; _tblLoanMaster.LoanTermOffered = _objLoanMasterDetails.LoanTermOffered; _tblLoanMaster.RateTypeOffered = _objLoanMasterDetails.RateTypeOffered; _tblLoanMaster.FrequencyOffered = _objLoanMasterDetails.FrequencyOffered; _tblLoanMaster.LoanValueRatio = _objLoanMasterDetails.LoanValueRatio; _tblLoanMaster.LoanAmountOffered = _objLoanMasterDetails.LoanAmountOffered; _tblLoanMaster.EMIStartDay = _objLoanMasterDetails.EMIStartDay; _tblLoanMaster.EMIStartMonth = _objLoanMasterDetails.EMIStartMonth; _tblLoanMaster.LoanProcessingFee = _objLoanMasterDetails.LoanProcessingFee; _tblLoanMaster.AnyLegalCharges = _objLoanMasterDetails.AnyLegalCharges; _tblLoanMaster.NoOfEMI = _objLoanMasterDetails.NoOfEMI; _tblLoanMaster.Loanprovider = _objLoanMasterDetails.Loanprovider; _tblLoanMaster.PropertyCost = _objLoanMasterDetails.PropertyCost; _tblLoanMaster.FinanceDate = _objLoanMasterDetails.FinanceDate; _tblLoanMaster.SettlementDate = _objLoanMasterDetails.SettlementDate; _tblLoanMaster.CreatedOn = DateTime.Now; db.tblLoanMasters.Add(_tblLoanMaster); db.SaveChanges(); } return(true); } } catch (Exception ex) { return(false); } }
public List <LoanMasterDetails> GetDataFromLoanApp(int AutoId) { try { using (AIMFinServDBEntities db = new AIMFinServDBEntities()) { Guid LoanAppNo = db.tblLoanApplicationForms.Where(x => x.AutoID == AutoId).Select(x => x.LoanApplicationNo).FirstOrDefault(); var datafromloanapp = (from tla in db.tblLoanApplicationForms join tlr in db.tblMasterLoanRateTypes on tla.RateTypeID equals tlr.ID where tla.LoanApplicationNo == LoanAppNo select new { _AutoId = tla.AutoID, _ApplicationFormNumber = tla.ApplicationFormNumber, _LoanTerm = tla.LoanTerm, _Frequency = tla.Frequency, _StatusID = tla.StatusID, _PropertyTypeID = tla.PropertyTypeID, _FinanceDate = tla.FinanceDate, _CostOfProperty = tla.CostOfProperty, _TypeOfLoanID = tla.TypeOfLoanID, _LoanRateType = tlr.LoanRateType }).ToList().Select(x => new LoanMasterDetails() { AutoID = x._AutoId, ApplicationFormNumber = x._ApplicationFormNumber, LoanTermOffered = x._LoanTerm, FrequencyOffered = x._Frequency, StatusID = x._StatusID, PropertyTypeID = x._PropertyTypeID, FinanceDate = x._FinanceDate, PropertyCost = x._CostOfProperty, LoanTypeID = x._TypeOfLoanID, RateTypeOffered = x._LoanRateType }).ToList(); return(datafromloanapp); } } catch (Exception ex) { return(null); } }
public bool UpdateLoanMasterDetails(LoanMasterDetails _objLoanMasterDetails) { try { using (AIMFinServDBEntities db = new AIMFinServDBEntities()) { var FetchLoanMasterDetails = db.tblLoanMasters.Where(p => p.LANNumber == _objLoanMasterDetails.LANNumber).FirstOrDefault(); if (FetchLoanMasterDetails != null) { FetchLoanMasterDetails.LoanApplicationNo = _objLoanMasterDetails.LoanApplicationNo; FetchLoanMasterDetails.LANNumber = _objLoanMasterDetails.LANNumber; FetchLoanMasterDetails.ROIOffered = _objLoanMasterDetails.ROIOffered; FetchLoanMasterDetails.AutoID = _objLoanMasterDetails.AutoID; FetchLoanMasterDetails.LoanTermOffered = _objLoanMasterDetails.LoanTermOffered; FetchLoanMasterDetails.RateTypeOffered = _objLoanMasterDetails.RateTypeOffered; FetchLoanMasterDetails.FrequencyOffered = _objLoanMasterDetails.FrequencyOffered; FetchLoanMasterDetails.LoanValueRatio = _objLoanMasterDetails.LoanValueRatio; FetchLoanMasterDetails.LoanAmountOffered = _objLoanMasterDetails.LoanAmountOffered; FetchLoanMasterDetails.ClientID = _objLoanMasterDetails.ClientID; FetchLoanMasterDetails.EMIStartDay = _objLoanMasterDetails.EMIStartDay; FetchLoanMasterDetails.EMIStartMonth = _objLoanMasterDetails.EMIStartMonth; FetchLoanMasterDetails.LoanProcessingFee = _objLoanMasterDetails.LoanProcessingFee; FetchLoanMasterDetails.AnyLegalCharges = _objLoanMasterDetails.AnyLegalCharges; FetchLoanMasterDetails.NoOfEMI = _objLoanMasterDetails.NoOfEMI; FetchLoanMasterDetails.Loanprovider = _objLoanMasterDetails.Loanprovider; FetchLoanMasterDetails.PropertyCost = _objLoanMasterDetails.PropertyCost; FetchLoanMasterDetails.FinanceDate = _objLoanMasterDetails.FinanceDate; FetchLoanMasterDetails.SettlementDate = _objLoanMasterDetails.SettlementDate; FetchLoanMasterDetails.PropertyTypeID = _objLoanMasterDetails._propertyTypeDetails.ID; FetchLoanMasterDetails.StatusID = _objLoanMasterDetails._typeOfStatusDetails.ID; FetchLoanMasterDetails.LoanTypeID = _objLoanMasterDetails._typeOfLoanDetails.ID; FetchLoanMasterDetails.ModifiedOn = DateTime.Now; db.SaveChanges(); } return(true); } } catch (Exception ex) { return(false); } }
public bool IsUserLoggedIn(string UserEmailId, string password) { bool status = false; using (AIMFinServDBEntities db = new AIMFinServDBEntities()) { var getusrdetails = db.tblUsers.Where(p => p.Email.ToLower() == UserEmailId.ToLower() && p.Password.ToLower() == password.ToLower()).FirstOrDefault(); if (getusrdetails != null) { if (getusrdetails.IsLoggedIn == true && getusrdetails.ActivaitonCode != null && getusrdetails.ActivaitonCode != string.Empty) { status = true; } else { status = false; } } return(status); } }
public IEnumerable <LoanMasterDetails> GetLoanMasterGrid(Guid LoanApplicationNo) { try { using (AIMFinServDBEntities db = new AIMFinServDBEntities()) { var datafromApplicants = (from tlm in db.tblLoanMasters join tba in db.tblApplicants on tlm.LoanApplicationNo equals tba.LoanApplicationNo join tmat in db.tblMasterApplicantTypes on tba.ApplicantTypeID equals tmat.ApplicantTypeID where tlm.LoanApplicationNo == LoanApplicationNo select new { _ApplicantID = tba.ApplicantID, _FirstName = tba.FirstName, _MiddleName = tba.MiddleName, _LastName = tba.LastName, _MobileNo = tba.MobileNo, _EmailId = tba.EmailID, _ApplicantType = tmat.ApplicantType }).ToList().Select(x => new LoanMasterDetails() { ApplicantID = x._ApplicantID, FirstName = x._FirstName, MiddleName = x._MiddleName, LastName = x._LastName, MobileNo = x._MobileNo, EmailID = x._EmailId, ApplicantType = x._ApplicantType }).ToList(); return(datafromApplicants); } } catch (Exception ex) { return(null); } }
public FinServBussinessEntities.Utility_Classes.AuthenticationDetails AuthenticateLogin(string UserEmailId, string password) { FinServBussinessEntities.Utility_Classes.AuthenticationDetails objReturnobj = new FinServBussinessEntities.Utility_Classes.AuthenticationDetails(); objReturnobj._IsAuthenticated = false; using (AIMFinServDBEntities db = new AIMFinServDBEntities()) { //the user is authenticated on admin website and landed on client if (password == null || password.Trim().Length == 0 || password.Trim() == "undefined".Trim()) { var getuserdetails = db.tblUsers.Where(p => p.Email.ToLower() == UserEmailId.ToLower()).FirstOrDefault(); if (getuserdetails != null) { var getUserRole = db.tblUsersRoles.Where(p => p.UserGuid == getuserdetails.UserGuid).FirstOrDefault(); if (getUserRole != null) { var getRole = db.tblRoles.Where(p => p.RoleGuid == getUserRole.RoleGuid).FirstOrDefault(); if (getRole != null) { objReturnobj._IsAuthenticated = true; objReturnobj._RoleDesc = getRole.Name; objReturnobj._UserID = Convert.ToString(getuserdetails.UserGuid); objReturnobj.ActivaitonCode = getuserdetails.ActivaitonCode; if (objReturnobj._RoleDesc == "Client") { var getApplicantID = db.tblApplicants.Where(p => p.EmailID == UserEmailId).FirstOrDefault(); if (getApplicantID != null) { objReturnobj._ApplicantID = Convert.ToString(getApplicantID.ApplicantID); } } } } } } else { //the user is authenticated and stays on admin website var getuserdetails = db.tblUsers.Where(p => p.Email.ToLower() == UserEmailId.ToLower() && p.Password.ToLower() == password.ToLower()).FirstOrDefault(); if (getuserdetails != null) { var getUserRole = db.tblUsersRoles.Where(p => p.UserGuid == getuserdetails.UserGuid).FirstOrDefault(); if (getUserRole != null) { var getRole = db.tblRoles.Where(p => p.RoleGuid == getUserRole.RoleGuid).FirstOrDefault(); if (getRole != null) { objReturnobj._IsAuthenticated = true; objReturnobj._RoleDesc = getRole.Name; objReturnobj._UserID = Convert.ToString(getuserdetails.UserGuid); if (objReturnobj._RoleDesc == "Admin") { objReturnobj._IsAuthenticated = true; objReturnobj._RoleDesc = getRole.Name; objReturnobj._UserID = Convert.ToString(getuserdetails.UserGuid); objReturnobj.IsLoggedIn = true; objReturnobj.ActivaitonCode = LoggedInUser(UserEmailId, password); } if (objReturnobj._RoleDesc == "Client") { var getApplicantID = db.tblApplicants.Where(p => p.EmailID == UserEmailId).FirstOrDefault(); if (getApplicantID != null) { objReturnobj._ApplicantID = Convert.ToString(getApplicantID.ApplicantID); } objReturnobj.IsLoggedIn = true; objReturnobj.ActivaitonCode = LoggedInUser(UserEmailId, password); } } } } } } return(objReturnobj); }
public LoanMasterDetails GetLoanMasterDetails(string lanNo) { try { LoanMasterDetails objtoReturn = new LoanMasterDetails(); Guid _LANNo = Guid.Parse(lanNo); using (AIMFinServDBEntities db = new AIMFinServDBEntities()) { var getLoanDetails = db.tblLoanMasters.Where(p => p.LANNumber == _LANNo).FirstOrDefault(); if (getLoanDetails != null) { objtoReturn.LoanApplicationNo = getLoanDetails.LoanApplicationNo; objtoReturn.LANNumber = getLoanDetails.LANNumber; objtoReturn.AutoID = getLoanDetails.AutoID; objtoReturn.ROIOffered = getLoanDetails.ROIOffered; objtoReturn.LoanTermOffered = getLoanDetails.LoanTermOffered; objtoReturn.RateTypeOffered = getLoanDetails.RateTypeOffered; objtoReturn.FrequencyOffered = getLoanDetails.FrequencyOffered; objtoReturn.LoanValueRatio = getLoanDetails.LoanValueRatio; objtoReturn.LoanAmountOffered = getLoanDetails.LoanAmountOffered; objtoReturn.ClientID = getLoanDetails.ClientID; objtoReturn.EMIStartDay = getLoanDetails.EMIStartDay; objtoReturn.EMIStartMonth = getLoanDetails.EMIStartMonth; objtoReturn.LoanProcessingFee = getLoanDetails.LoanProcessingFee; objtoReturn.AnyLegalCharges = getLoanDetails.AnyLegalCharges; objtoReturn.NoOfEMI = getLoanDetails.NoOfEMI; objtoReturn.Loanprovider = getLoanDetails.Loanprovider; objtoReturn.PropertyCost = getLoanDetails.PropertyCost; objtoReturn.FinanceDate = getLoanDetails.FinanceDate; objtoReturn.SettlementDate = getLoanDetails.SettlementDate; objtoReturn.LoanTypeID = getLoanDetails.LoanTypeID; objtoReturn._typeOfLoanDetails = new LoanTypeMaster(); objtoReturn._typeOfLoanDetails.ID = getLoanDetails.tblMasterTypeOfLoan.ID; objtoReturn._typeOfLoanDetails.LoanType = getLoanDetails.tblMasterTypeOfLoan.LoanType; objtoReturn._typeOfLoanDetails.IsActive = getLoanDetails.tblMasterTypeOfLoan.IsActive; objtoReturn.PropertyTypeID = getLoanDetails.PropertyTypeID; objtoReturn._propertyTypeDetails = new PropertyTypeMaster(); objtoReturn._propertyTypeDetails.ID = getLoanDetails.tblMasterPropertyType.ID; objtoReturn._propertyTypeDetails.PropertyType = getLoanDetails.tblMasterPropertyType.PropertyType; objtoReturn.StatusID = getLoanDetails.StatusID; objtoReturn._typeOfStatusDetails = new StatusTypeMaster(); objtoReturn._typeOfStatusDetails.ID = getLoanDetails.tblMasterTypeOfStatu.ID; objtoReturn._typeOfStatusDetails.Status = getLoanDetails.tblMasterTypeOfStatu.Status; objtoReturn._typeOfStatusDetails.IsActive = getLoanDetails.tblMasterTypeOfStatu.IsActive; objtoReturn._loanApplicationDetails = new LoanApplicationForms(); objtoReturn._loanApplicationDetails.LoanApplicationNo = getLoanDetails.tblLoanApplicationForm.LoanApplicationNo; objtoReturn._loanApplicationDetails.ApplicationFormNumber = getLoanDetails.tblLoanApplicationForm.ApplicationFormNumber; objtoReturn._loanApplicationDetails.AdvisorID = getLoanDetails.tblLoanApplicationForm.AdvisorID; objtoReturn._loanApplicationDetails._AdvisorID = new AdvisorTypeDetails(); objtoReturn._loanApplicationDetails._AdvisorID.Name = getLoanDetails.tblLoanApplicationForm.tblAdvisorDetail.Name; objtoReturn._loanApplicationDetails._AdvisorID.FirmName = getLoanDetails.tblLoanApplicationForm.tblAdvisorDetail.FirmName; objtoReturn._loanApplicationDetails._AdvisorID.EmailID = getLoanDetails.tblLoanApplicationForm.tblAdvisorDetail.EmailID; objtoReturn._loanApplicationDetails._AdvisorID.AdvisorCode = getLoanDetails.tblLoanApplicationForm.tblAdvisorDetail.AdvisorCode; objtoReturn._loanApplicationDetails._AdvisorID.AdvisorGroup = getLoanDetails.tblLoanApplicationForm.tblAdvisorDetail.AdvisorGroup; objtoReturn._loanApplicationDetails._AdvisorID.PhoneNo = getLoanDetails.tblLoanApplicationForm.tblAdvisorDetail.PhoneNo; objtoReturn._loanApplicationDetails._AdvisorID.MobileNo = getLoanDetails.tblLoanApplicationForm.tblAdvisorDetail.MobileNo; objtoReturn._loanApplicationDetails._AdvisorID.IsActive = getLoanDetails.tblLoanApplicationForm.tblAdvisorDetail.IsActive; //objtoReturn.CreatedBy = getLoanDetails.CreatedBy; //objtoReturn.CreatedOn = getLoanDetails.CreatedOn; //objtoReturn.ModifiedBy = getLoanDetails.ModifiedBy; //objtoReturn.ModifiedOn = getLoanDetails.ModifiedOn; } return(objtoReturn); } } catch (Exception e) { return(null); } }
public List <LoanMasterDetails> GetAllLoanMasterDetails() { List <LoanMasterDetails> objLoanMaster = new List <LoanMasterDetails>(); try { using (AIMFinServDBEntities db = new AIMFinServDBEntities()) { var getAllLoans = db.tblLoanMasters.ToList(); foreach (var item in getAllLoans) { objLoanMaster.Add(new LoanMasterDetails { LANNumber = item.LANNumber, LoanApplicationNo = item.LoanApplicationNo, LoanAmountOffered = item.LoanAmountOffered, ROIOffered = item.ROIOffered, RateTypeOffered = item.RateTypeOffered, LoanTermOffered = item.LoanTermOffered, FrequencyOffered = item.FrequencyOffered, PropertyTypeID = item.PropertyTypeID, LoanTypeID = item.LoanTypeID, FinanceDate = item.FinanceDate, ClientID = item.ClientID, StatusID = item.StatusID, _loanApplicationDetails = new LoanApplicationForms() { LoanApplicationNo = item.tblLoanApplicationForm.LoanApplicationNo, ApplicationFormNumber = item.tblLoanApplicationForm.ApplicationFormNumber, IsApplicationApproved = item.tblLoanApplicationForm.IsApplicationApproved, CostOfProperty = item.tblLoanApplicationForm.CostOfProperty, AdvisorID = item.tblLoanApplicationForm.AdvisorID, _AdvisorID = new AdvisorTypeDetails() { AdvisorCode = item.tblLoanApplicationForm.tblAdvisorDetail.AdvisorCode, FirmName = item.tblLoanApplicationForm.tblAdvisorDetail.FirmName, EmailID = item.tblLoanApplicationForm.tblAdvisorDetail.EmailID, Name = item.tblLoanApplicationForm.tblAdvisorDetail.Name, } }, _typeOfLoanDetails = new LoanTypeMaster() { ID = item.tblMasterTypeOfLoan.ID, LoanType = item.tblMasterTypeOfLoan.LoanType, IsActive = item.tblMasterTypeOfLoan.IsActive, }, _propertyTypeDetails = new PropertyTypeMaster() { ID = item.tblMasterPropertyType.ID, PropertyType = item.tblMasterPropertyType.PropertyType, IsActive = item.tblMasterPropertyType.IsActive, }, _typeOfStatusDetails = new StatusTypeMaster() { ID = item.tblMasterTypeOfStatu.ID, Status = item.tblMasterTypeOfStatu.Status, IsActive = item.tblMasterTypeOfStatu.IsActive, } }); } return(objLoanMaster); } } catch (Exception e) { return(null); } }
//public string SendEmail(string chooseTemplate) //private string SendEmail(string str) //{ // MailMessage mail = new MailMessage(); // SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com", 587); // SmtpServer.Credentials = new System.Net.NetworkCredential("*****@*****.**", "sandy@9871"); // SmtpServer.EnableSsl = true; // mail.From = new MailAddress("*****@*****.**"); // mail.To.Add("*****@*****.**"); // mail.CC.Add("*****@*****.**"); // mail.Subject = "Test"; // // "This is test mail"; // // mail.Body = GenerateNewLetterTemplate(); // mail.IsBodyHtml = true; // //if chooseTemplate="New" call GenerateNewLetterTemplate() and if chooseTemplate="ChangePassword" call GenerateTemplateForPassword // // mail.Body = System.IO.File.ReadAllText(HttpContext.Current.Server.MapPath("EmailTemplates/ChangePassword.html")); // //Body = Body.Replace("#ClientName#", _lstGetDealerRoleAndContactInfoByCompanyIDResult[0].CompanyName); // SmtpServer.Send(mail); // mail.Dispose(); // return "sent"; //} public bool GenerateUserTemplate(Guid UserGuid) { EmailTemplate objToReturn = new EmailTemplate(); using (AIMFinServDBEntities db = new AIMFinServDBEntities()) { var GetEmailTemplateDetails = db.tblUsers.Where(p => p.UserGuid == UserGuid).FirstOrDefault(); if (GetEmailTemplateDetails != null) { objToReturn.EmailID = GetEmailTemplateDetails.Email; objToReturn.DisplayName = GetEmailTemplateDetails.DisplayName; objToReturn.Password = GetEmailTemplateDetails.Password; objToReturn.UserId = GetEmailTemplateDetails.UserId; } // string clientName = "Mahesh"; string Email = WebConfigurationManager.AppSettings["ClientEmailId"]; string Password = WebConfigurationManager.AppSettings["ClientPassword"]; string str = null; MailMessage mail = new MailMessage(); SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com", 587); SmtpServer.Credentials = new System.Net.NetworkCredential(Email, Password); SmtpServer.EnableSsl = true; mail.From = new MailAddress("*****@*****.**"); mail.To.Add("*****@*****.**"); mail.CC.Add("*****@*****.**"); mail.Subject = "Test"; // "This is test mail"; mail.Body = str; mail.IsBodyHtml = true; str = @"<!doctype html> <html> <body> <div style='font-size: 16px; padding-bottom: 0px; margin:0px auto; color: black; padding-top: 0px; font-family: Arial, Helvetica, sans-serif; width:722px; border:none;'> <table width='100%' border='0' cellpadding='0' cellspacing='0' bgcolor='#1b9ec5' style='border: none; margin:auto;'> <tbody> <tr><td valign='top' align='center' style='padding:10px;'><img src='http://aimfinancialservices.co.nz/wp-content/uploads/2016/07/AIM_white.png' alt='' width='182' style='border:0; display:block; margin-top:5px;'></td></tr> <tr> <td width='100%'> <h2 style='text-align:center; color:#FFF; margin:0px; padding:0px;'><em>Welcome to Aim Financial Services</em></h2> </td> </tr> <tr> <td> <table width='100%' border='0' cellspacing='0' cellpadding='0' bgcolor='#1b9ec5'> <tr> <td> <table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr><td colspan='3' height='20'></td> </tr> <tr> <td width='20'></td> <td bgcolor='#ffffff'> <table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr> <td> <table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr> <td width=' 34'> </td> <td align='center'> <table border='0' cellspacing='0' cellpadding='0'> <tr><td height='37'></td></tr> <tr><td style='color:#626f78; font-size: 21px' align='center'>Dear"; str += " "; str += objToReturn.DisplayName; str += @"</td></tr> <tr><td height='11'></td></tr> <tr><td align='center' style='color:#626f78; font-size: 17px'>You have successfully registered to AIM! </td></tr> <tr> <td height='20' width='100%'></td> </tr> </table> </td> <td width=' 34'> </td> </tr> </table> </td> </tr> <tr> <td> <table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='100%'> <table width='100%'> <tr> <td width='10%;'></td> <td width='80%;' style='padding-top:20px; padding-bottom:20px;'> <p style='color:#626f78; font-size: 14px' align='center'><strong>UserId:</strong>"; str += " "; str += objToReturn.EmailID; str += @"</p> <p style='color:#626f78; font-size: 14px' align='center'><strong>Password:</strong>"; str += " "; str += objToReturn.Password; str += @"</p> </td> <td width='10%;'></td> </tr> </table> </td> </tr> <tr><td height='60px' style='color:#626f78; font-size: 14px' align='center'>To review and update your profile, please log on to AIM. </td></tr> <tr><td height='10'></td></tr> <tr> <td bgcolor='#ebebeb' align='center' valign='middle' height='120'> <a href='http://www.loaner.co.nz/' click='LoginHereClick()' style='width:170px; padding:15px; text-align:center; border-radius:20px; display:block; background:#269226; text-decoration:none; color:#FFF;'> Login Here</a> </td> </tr> </table> </td> </tr> </table> </td> <td width='20'></td> </tr> <tr><td colspan='3' height='20'></td></tr> </table> </td> </tr> <tr> <td> <table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr> <td width='19'> </td> <td> <table width='100%' border='0' cellspacing='0' cellpadding='0'> <tr> <td style='color:#ededed; font-size: 12px'> <p> <strong>Contact Number:</strong> 09 282 3782 <br /> <strong>Email:</strong> [email protected] <br /> <strong>Website:</strong> http://aimfinancialservices.co.nz/ </p> </td> </tr> </table> </td> <td width='19'> </td> </tr> </table> </td> </tr> <tr><td height='20'></td></tr> </table> </td> </tr> </tbody> </table> </div> </body> </html> "; mail.Body = str; mail.IsBodyHtml = true; try { SmtpServer.Send(mail); } catch (Exception ex) { } mail.Dispose(); return(true); } }