// GET: api/[email protected] public IHttpActionResult GetUser(string emailAddress) { response.status = "FAILURE"; try { var searchUser = db.UserInformations.Where(u => u.EmailAddress.ToLower().Equals(emailAddress.ToLower())) .Include(ui => ui.User) .ToArray(); if (searchUser.Length > 0) { String header, body, footer; //send email GMailer.GmailUsername = "******"; GMailer.GmailPassword = "******"; GMailer mailer = new GMailer(); header = "Hi " + searchUser[0].FirstName + "<br><br>" + "Good Day! <br> <br>"; body = "Account Information: <br>"; body += "Username: "******"<br>"; body += "Password: "******"<br> <br>"; footer = "Yours Truly, <br> Smile Fairies Dental Suites"; mailer.ToEmail = searchUser[0].EmailAddress; mailer.Subject = "Account Information"; mailer.Body = header + body + footer; mailer.IsHtml = true; mailer.Send(); response.status = "SUCCESS"; response.message = "An email has been sent to your email address."; } else response.message = "User doesn't exist."; } catch (Exception e) { response.message = e.Message.ToString(); } return Ok(response); }
private void emailUrl(string url, string recipient, string firstName) { String header, body, footer; //send email GMailer.GmailUsername = "******"; GMailer.GmailPassword = "******"; GMailer mailer = new GMailer(); header = "Hi " + firstName + "<br><br>" + "Good Day! <br> <br>"; body = "For security purposes , please activate your account by clicking the link below. <br><br>Verification Link: <a href='" + url + "'>" + url + "</a>" + ".<br><br>Thank you and God Bless! <br><br>"; footer = "Yours Truly, <br> Smile Fairies Dental Suites"; mailer.ToEmail = recipient; mailer.Subject = "Account Activation"; mailer.Body = header + body + footer; mailer.IsHtml = true; mailer.Send(); }