public ActionResult InviteFriends(InviteFriends inviteFriends) { string[] emails = inviteFriends.FriendsEmails.Split(','); RegisteredUser user = GetUser(); ClosetOutfit co = closetOutfitRepository.Get(Convert.ToInt32(inviteFriends.OutfitId)); SmtpMailing mail = new SmtpMailing(); foreach (string email in emails) { string subject = user.FullName + " want that you rate her outfit"; string body = ""; foreach (Garment garment in co.Components) { body += "<img src='" + inviteFriends.SiteURL + "/" + Resources.GetGarmentPath(garment) + "' alt='" + garment.Title + "' /> "; } string key = Guid.NewGuid().ToString(); body += "<br /><br />Rate it NOW <a href='" + inviteFriends.SiteURL + "/rating/index/" + key + "/default.aspx' style='color: #F38333;' >here</a>!"; FriendRatingInvitation invitation = new FriendRatingInvitation(); invitation.FriendEmail = email; invitation.InvitationSentOn = DateTime.Now; invitation.FriendRateOn = invitation.InvitationSentOn; invitation.KeyCode = key; invitation.Message = inviteFriends.Message; invitation.User = user; invitation.ClosetOutfit = co; friendRatingInvitationRepository.SaveOrUpdate(invitation); mail.SendMail(email, "Rate my outfit", subject, body, false); } if (inviteFriends.SendMe) { string subject = user.FullName + " want that you rate her outfit"; string body = ""; foreach (Garment garment in co.Components) { body += "<img src='" + inviteFriends.SiteURL + "/" + Resources.GetGarmentPath(garment) + "' alt='" + garment.Title + "' /> "; } body += "<br /><br />Rate it NOW <span style='color: #F38333;' >here</span>! <span style='font-size=10px;'>(only your friends get the rating link)</span>"; mail.SendMail(user.EmailAddress, "Rate my outfit", subject, body, false); } return(Json(new { Success = true })); }
protected void Application_Error(object sender, EventArgs e) { #if !DEBUG string error = Server.GetLastError().ToString(); SmtpMailing wm = new SmtpMailing(); wm.SendMail(Config.SupportEmail, "", "Error en Despiece", error, false); Utils.GetLogger().Error(Server.GetLastError().Message, Server.GetLastError().GetBaseException()); #endif }
private void SendMail(string fullName, SmtpMailing mail, string email, string siteURL) { string subject = fullName + " want to invite you to build your closet"; string body = ""; body += "<br /><br />Join NOW <a href='" + siteURL + "/' style='color: #F38333;' >here</a>!"; mail.SendMail(email, "Crate your own virtual closet", subject, body, false); }
public RedirectToRouteResult PasswordRecovery(string UserName, string Answer) { MembershipUser mu = Membership.GetUser(UserName); try { string newpassword = mu.ResetPassword(Answer); SmtpMailing mail = new SmtpMailing(); string body = newpassword + "<br /><br /><h2 style='font-family:Century Gothic; color:#4D679B; font-weight:bold; font-size:14px; margin:0 0 0 30px; padding-bottom:2px;'>Please use it to login and change it in PROFILE page.</h2>"; mail.SendMail(mu.Email, "Password Reset", "Your new password is", body, false); Session["Errors"] = "Your new password has been sent by email, please check your inbox."; return(RedirectToAction("Index")); } catch (Exception e) { Session["Errors"] = e.Message; } return(RedirectToAction("ForgotPassword")); }