Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Send Email NotificationSend Email Notification
Previous
 
Next
New Post
5/9/2007 5:27 PM
 

Hi

Im developing a custom registration module. I have successfully created the user, but im getting error when i try to send the email notification to the registered user. Im using the code something similar to the following.

 

UserInfo uUserInfo = newUserCreateStatus sStatus = new UserCreateStatus(); 

DotNetNuke.Entities.Users.

uUserInfo.Profile.InitialiseProfile(this.PortalId)

uUserInfo.PortalID = PortalId;

uUserInfo.Username = TxtUserName.Text;

uUserInfo.DisplayName = TxtUserName.Text;

uUserInfo.FirstName = TxtFirstName.Text;

uUserInfo.LastName = TxtLastName.Text;

uUserInfo.Email = TxtEmail.Text;

uUserInfo.Membership.Approved = true;

uUserInfo.Membership.Password = TxtPassword.Text;

uUserInfo.Profile.LastName = TxtLastName.Text;

uUserInfo.Profile.FirstName = TxtFirstName.Text;

 

 

 

sStatus =

 

UserController.CreateUser(ref uUserInfo); settings = DotNetNuke.Entities.Portals.PortalSettings. 

DotNetNuke.Entities.Portals.PortalSettings

 

if (sStatus == UserCreateStatus.Success)

{

Mail.SendMail(uUserInfo, MessageType.UserRegistrationPublic, settings);

}

And this is the error from the logviewer.

DotNetNuke.Services.Exceptions.ModuleLoadException: Object reference not set to an instance of an object. ---> System.NullReferenceException: Object reference not set to an instance of an object. at DotNetNuke.Services.Localization.TokenReplace.calc(String strObjectName, String strPropertyName, String strFormat, ArrayList Custom, DataRow Row) at DotNetNuke.Services.Localization.TokenReplace.ReplaceEnvironmentTokens(String strSourceText, ArrayList Custom, DataRow Row) at DotNetNuke.Services.Localization.Localization.GetSystemMessage(String strLanguage, PortalSettings objPortal, String MessageName, UserInfo objUser, String ResourceFile, ArrayList Custom) at DotNetNuke.Services.Mail.Mail.SendMail(UserInfo user, MessageType msgType, PortalSettings settings)

What should i do. please help me.

Thanks in advance

 

DotNetNuke.Entities.Users.

 
New Post
5/16/2007 11:04 PM
 

DotNetNuke.Entities.Portals.PortalSettings is a ReadOnly property so your code can just use

 Mail.SendMail(uUserInfo, MessageType.UserRegistrationPublic, PortalSettings);

 

Im assuming the is that and not inside the SendMail routine.


Philip Beadle - Employee
 
New Post
5/17/2007 12:33 AM
 

i used this code and it is working now

sStatus = UserController.CreateUser(ref uUserInfo);
               
                DotNetNuke.Entities.Portals.PortalController cController = new DotNetNuke.Entities.Portals.PortalController();
                DotNetNuke.Entities.Portals.PortalInfo iInfo = new DotNetNuke.Entities.Portals.PortalInfo();
                DotNetNuke.Entities.Portals.PortalAliasInfo aAlias = new DotNetNuke.Entities.Portals.PortalAliasInfo();
                aAlias.PortalID = this.PortalId;
                DotNetNuke.Entities.Portals.PortalSettings settings = new DotNetNuke.Entities.Portals.PortalSettings(iInfo.HomeTabId, aAlias);
              
                if (sStatus ==  UserCreateStatus.Success)
                {               
                    Mail.SendMail(uUserInfo, MessageType.UserRegistrationPublic, settings);                   
                }

Thanks for your reply.

 

 
New Post
5/17/2007 12:33 AM
 

i used this code and it is working now

sStatus = UserController.CreateUser(ref uUserInfo);
               
                DotNetNuke.Entities.Portals.PortalController cController = new DotNetNuke.Entities.Portals.PortalController();
                DotNetNuke.Entities.Portals.PortalInfo iInfo = new DotNetNuke.Entities.Portals.PortalInfo();
                DotNetNuke.Entities.Portals.PortalAliasInfo aAlias = new DotNetNuke.Entities.Portals.PortalAliasInfo();
                aAlias.PortalID = this.PortalId;
                DotNetNuke.Entities.Portals.PortalSettings settings = new DotNetNuke.Entities.Portals.PortalSettings(iInfo.HomeTabId, aAlias);
              
                if (sStatus ==  UserCreateStatus.Success)
                {               
                    Mail.SendMail(uUserInfo, MessageType.UserRegistrationPublic, settings);                   
                }

Thanks for your reply.

 

 
New Post
5/17/2007 12:35 AM
 

You do not need to do this DotNetNuke.Entities.Portals.PortalSettings settings = new DotNetNuke.Entities.Portals.PortalSettings(iInfo.HomeTabId, aAlias);

Just make sure your module inherits from PortalModuleBase and then you can access the PortalSettings exactly as i showed you.

Cheers


Philip Beadle - Employee
 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Send Email NotificationSend Email Notification


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out