Is there any way to send verification code from code? meaning that if I choose "Verify" from Admin --> Settings --> Advance Settings --> Security Settings to "Verify" then IF i created a new user from code it will automatically send the notification to user. User have to click a verification link as usual.
But I don't want to use it from Admin menu. Just from code.
I have try to use this code, but no luck. :(
UserCreateStatus createStatus = UserController.CreateUser(
ref
ui); // ui is UserInfo object i created before.
DotNetNuke.Entities.Modules.UserUserControlBase.UserCreatedEventArgs args;
if
(createStatus == UserCreateStatus.Success)
{
args =
new
UserUserControlBase.UserCreatedEventArgs(ui);
args.Notify =
true
;
string
body =
"Dear "
+ ui.DisplayName +
"<br /><br />We are pleased to announce that you are registered in our website. If you need any assist, don't hesitate to contact us at webmaster@test.com. <br /><br />Thank you.<br /><br />--- Webmaster ---"
;
string
strMessage = DotNetNuke.Services.Mail.Mail.SendMail(
"webmaster@test.com"
,
ui.Email,
""
,
""
,
DotNetNuke.Services.Mail.MailPriority.Normal,
"New User Registration"
,
DotNetNuke.Services.Mail.MailFormat.Html,
System.Text.Encoding.UTF8,
body,
""
,
Host.SMTPServer, Host.SMTPAuthentication, Host.SMTPUsername, Host.SMTPPassword, Host.EnableSMTPSSL);
}
else
{
args =
new
UserUserControlBase.UserCreatedEventArgs(
null
);
}
args.CreateStatus = createStatus;
UserUserControlBase ub =
new
UserUserControlBase();
ub.OnUserCreated(args);
ub.OnUserCreateCompleted(args);
Thank you very much.