API for sending a confirmation email for a new user.
How would I go about sending a confirmation email after a new registration without using the existing registration widget? In other words, what's the namespace/api for sending confirmation emails.
Alternatively, how would I go about adding "sign up to the newsletter" as part of the registration widget? I would idealy like users to be able to decide to sign up for the newsletter as part of the registration process, and not have to fill out extra fields in a separate widget.
I also need to know how to accomplish this in v5.1
Had anyone got an answer in this regard?.
Thank you
If you are using Sitefinity 5.2 or above, then you are probably able to make use of the IEventService and Eventhub. I'm not sure though if you are able to hook in into the user registration process.
Here's a link to the documentation: www.sitefinity.com/.../sitefinity-event-system
Hi guys,
Here are some suggestions:
1. How would I go about sending a confirmation email after a new registration without using the existing registration widget? In other words, what's the namespace/api for sending confirmation emails.
One easy approach would be to replace the default User service with a custom one, that inherits from teh default service. this will allow you to implement the IUsers interface and take advantage of the CreateUser public method. Here's an example of the custom service. Simply add a class file to you project wtih the following code in it:
public class UsersServiceCustom:Users, IUsers public WcfMembershipUser CreateUser(WcfMembershipUser user, string userId, string provider) //you can get ahold of the created user from the User parameter of the method //e.g. var myUser = user; return base.CreateUser(user, userId, provider); <%@ ServiceHost Language="C#" Debug="false" Service="SitefinityWebApp.UsersServiceCustom" Factory="Telerik.Sitefinity.Web.Services.WcfHostFactory" %>var smtpSettings = Config.Get<SystemConfig>().SmtpSettings;MailMessage message = new MailMessage();message.From = new MailAddress(smtpSettings.DefaultSenderEmailAddress);message.To.Add(new MailAddress("someone@example.com"));StringBuilder sb = new StringBuilder();sb.AppendFormat("You have been registered");message.Subject = "Comments notification";message.Body = sb.ToString();message.IsBodyHtml = true;message.BodyEncoding = Encoding.Unicode;message.SubjectEncoding = Encoding.Unicode;EmailSender.Get().Send(message);