public int EmailForInvitation(InvitePeople people) { int user = _signup.GetId(people.Email); List <Projectmembers> member = _Projectmembers.getMemberDetails(user); foreach (var memberdetail in member) { if (memberdetail.ProjectId.ToString() == people.ProjectId) { return(0); } } var message = new MimeMessage(); message.From.Add(new MailboxAddress(_config["EmailConfig:Title"], _config["EmailConfig:FromEmail"])); //mail title and mail from(Email) message.To.Add(new MailboxAddress(people.Email)); //mail to(client) message.Subject = _config["EmailConfig:SubjectForInvitation"]; //mail subject var bodyBuilder = new BodyBuilder(); //body of the mail if (user != 0) { bodyBuilder.HtmlBody = "Click here to join project- http://localhost:4200/app-signup/" + people.ProjectId; //link sent in mail } else { bodyBuilder.HtmlBody = "Click here to join project- http://localhost:4200/app-register/" + people.ProjectId; //link sent in mail } message.Body = bodyBuilder.ToMessageBody(); using (var client = new SmtpClient()) { //required field for email client.Connect(_config["EmailConfig:Domain"], 587, false); client.Authenticate(_config["EmailConfig:FromEmail"], _config["EmailConfig:Password"]); client.Send(message); client.Disconnect(true); } return(1); }
//this method updates the user details public int Get(string email) { return(_context.GetId(email)); }