Subscription - debugging mail send failure

Paul Kennett
Member since: 2007
 

Our subscription process is not sending external emails.  This will be related to the mail server set up which is being looked at BUT my question lies here: 

Is there a way to get more information for the logging generated during the subscription task running.  Currently the only entry is:

 2009-04-08 11:42:24,812 WARN [11] EPiServer.Personalization.SubscriptionMail.Send - 4.3.1  Invalid email address found (skip mail):

It is supposed to show the email that is skipped - but doesn't.  I'd like to be able to get more info out of the logs.

 

#29145 Apr 09, 2009 1:14
  • Paul Kennett
    Member since: 2007
     
    Update:  Mail server set up is not at fault.

    It turns out not  to be external emails that weren't being sent - but emails to users who are not assigned to roles (any role) within EPiServer.  

    Using the demo site registration page [actual code can be supplied] new registered users aren't placed in any role.  Applying a role - seemingly any role - via the EPiServer Admin then allows their email to be sent ... otherwise, if they're not in a role this is when the log reports:

    2009-04-08 11:42:24,812 WARN [11] EPiServer.Personalization.SubscriptionMail.Send - 4.3.1  Invalid email address found (skip mail):


    New  first question then is: how do you go about assigning a new registered user to a role automatically.  We are using the asp:CreateUserWizard
     
    New second question is: why does the subscription schedule task skip sending emails for accounts with no roles
    #29233 Edited, Apr 17, 2009 1:30
  • Magnus Rahl
    Member since: 2008
     

    For the first question: Hook into the CreateUserWizard.CreatedUser event to add the new user to a role in your event handler.

    #29276 Apr 20, 2009 7:44
  • morten.sorby
    Member since: 2006
     

    Hi,

    I've stubled upon this issue, and it's wierd.
    What I've found is this:
    1.I create a user throught the asp:createuserwizard. Sending verification e-mail.
    2.Verifying user, setting it active(ie IsApproved)
    3. See that the user is activated in EPiServer admin
    4. Checing the database to see that the user is registed in the aspnet_Membership table
    5. Making the newly created user subscribe to something.
    6. Run the subscription job.
    7. Now this is where it gets wierd: The EPiServerProfile.Email is an empty string, the property EmailWithMembershipFallback has the correct email address....
    If I go into admin mode and open the user and then save it, without doing nothing to it the EPiServerProfile.Email property is populated....

    Anyone else seen this?

    Regards,

    Morten

    #30756 Jun 18, 2009 13:30
  • Paul Kennett
    Member since: 2007
     

    At last - some replication of the problem.  I think we are not too far away from determining the solution. In the last couple of days I have been able to determine the same as you find (although I had a slightly more complicated scenario ... because I had earlier thought that adding users to a subscribers group was part of the issue ... forwhich I added the following code to my OnCreatedUser hook of the createuserwizard - as suggested by @Magnus above)

      protected void On_CreatedUser(object sender, EventArgs e)
    {
    // user has been created so add to subscribers role.
    // get the username value from the wizard
    string strUserName = RegistrationWizard.UserName.ToString();
    if (!Roles.RoleExists("Subscribers")) {
    Roles.CreateRole("Subscribers");
    }
    Roles.AddUserToRole(strUserName, "Subscribers");
    }

    I have just read this post which demonstrates the same - also from Magnus - 

    http://world.episerver.com/Forum/Pages/thread.aspx?id=29569

    These are both highly related.

    Now, to think about a solution:

    I'm going to user the oncreateduser hook of the createuserwizard to also populate the EPiServerProfile.email with the registrants email address.  

    Keeping you posted... 

    #31028 Jul 01, 2009 0:43
  • Paul Kennett
    Member since: 2007
     

    And finally...

    As discussed by Moten above the createuserwizard was not adding the user's email to their EPiServerProfile.Email. 

    I chose to change the subscription process so that after registration, a check for EPiServerProfile.Mail field being empty would result in users EmailWithMembershipFallback value being copied in to their EPiServerProfile.Mail field when confirming the subscriptions they require.

    New registrants now receive email as expected.

    #31145 Jul 06, 2009 0:25