public void SendTestEmail( User user ) { string emailSubject = "Test RegistrationVerificationEmail"; IDictionary tokens = new Hashtable(); tokens.Add( "user", user ); tokens.Add( "linkBack", "linkbackUrl" ); tokens.Add( "homeurl", homeUrl ); string emailBody = GenerateEmailText( tokens, "RegistrationVerificationEmail.vm" ); SendMail( user.Email, emailSubject, emailBody, true ); }
public void SendTestEmail( Post post, User user ) { string emailSubject = "Test PostMail"; IDictionary tokens = new Hashtable(); tokens.Add( "post", post ); tokens.Add( "user", user ); tokens.Add( "postdate", post.PublishDateTime.ToFriendlyJumblistLongDateTimeString( false ) ); tokens.Add( "homeurl", homeUrl ); string emailBody = GenerateEmailText( tokens, "TestEmail.vm" ); SendMail( user.Email, emailSubject, emailBody, true ); }
public void SendRegistrationVerificationEmail( User user ) { string emailSubject = "Registration Verification Mail"; string encryptedId = user.UserId.ToString().EncryptString(); string encryptedUrlEncodedId = HttpUtility.UrlEncode( encryptedId ); string urlEncodedEmail = HttpUtility.UrlEncode( user.Email ); string linkBack = homeUrl + "/users/verifyregistration?userid=" + encryptedUrlEncodedId + "&useremail=" + urlEncodedEmail; IDictionary tokens = new Hashtable(); tokens.Add( "user", user ); tokens.Add( "linkBack", linkBack ); tokens.Add( "homeurl", homeUrl ); string emailBody = GenerateEmailText( tokens, "RegistrationVerificationEmail.vm" ); SendMail( user.Email, emailSubject, emailBody, true ); }
public void SendForgottenPasswordEmail( User user ) { string emailSubject = "Forgotten Password"; string encryptedId = user.UserId.ToString().EncryptString(); string encryptedUrlEncodedId = HttpUtility.UrlEncode( encryptedId ); string linkBack = homeUrl + "/users/passwordreset?reset=" + encryptedUrlEncodedId; IDictionary tokens = new Hashtable(); tokens.Add( "user", user ); tokens.Add( "linkBack", linkBack ); tokens.Add( "homeurl", homeUrl ); string emailBody = GenerateEmailText( tokens, "ForgottenPasswordEmail.vm" ); SendMail( user.Email, emailSubject, emailBody, true ); }
public void SendPasswordResetEmail( User user, string password ) { string emailSubject = "Your new password"; string linkBack = homeUrl + "/users/login"; IDictionary tokens = new Hashtable(); tokens.Add( "user", user ); tokens.Add( "password", password ); tokens.Add( "linkBack", linkBack ); string emailBody = GenerateEmailText( tokens, "PasswordResetEmail.vm" ); SendMail( user.Email, emailSubject, emailBody, true ); }
public void SendBasketEmail( Basket basket, User user ) { string emailSubject = "Basket Mail"; IDictionary tokens = new Hashtable(); tokens.Add( "basket", basket ); tokens.Add( "user", user ); tokens.Add( "homeurl", homeUrl ); string emailBody = GenerateEmailText( tokens, "BasketEmail.vm" ); SendMail( user.Email, emailSubject, emailBody, true ); }
public static Expression<Func<Post, bool>> WhereUserEquals( User user ) { return x => x.UserId == user.UserId; }
public ActionResult EmailTest() { string recipientEmail = "*****@*****.**"; //string recipientEmail = "*****@*****.**"; User user = new User(); user.UserId = 35; user.Name = "Stuart"; user.Email = recipientEmail; user.Postcode = "TN31 6HG"; Post post = postService.SelectRecord( 5001 ); UserAlert userAlert = new UserAlert(); userAlert.Name = "My great alert"; userAlert.User = user; IQueryable<Post> postList = postService.SelectRecordList( Post.WhereDisplayEquals( true ) ).OrderByDescending( t => t.PublishDateTime ).Take( 5 ); //mailService.SendTestEmail( post, user ); //mailService.SendTestEmail( user ); //mailService.SendRegistrationVerificationEmail( user ); mailService.SendPostEmail( post, user ); //mailService.SendForgottenPasswordEmail( user ); //mailService.SendPasswordResetEmail( user, "newpassword" ); //mailService.SendEmailAlert( userAlert, postList ); var model = DefaultView.CreateModel(); model.PageTitle = "2 Test Emails Sent"; model.Message = new Message() { Text = "The recipient email address was " + recipientEmail + " and the BCC was " + ConfigurationManager.AppSettings["AdminEmail"], StyleClass = "message" }; return View( model ); }
public static Expression<Func<User, bool>> WhereNotEquals( User user ) { return x => x.UserId != user.UserId; }
public BaseViewModel With( User user ) { this.User = user; return this; }