Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Evan 344 posts 99 karma points
    Apr 20, 2009 @ 20:16
    Evan
    0

    Send an email when a member is created?

    Is there a way to send an email when a member is created that will contain their username and password to login?

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Apr 20, 2009 @ 20:36
    Morten Bock
    0

    In V4 there are events for that.

    Something like (not tested)

    public class MailEventHandler : ApplicationBase
    {
    public MailEventHandler()
    {
    Member.AfterNew += MemberAfterNew;
    }

    protected void Member
    AfterNew(object sender, PublishEventArgs e)
    {
    //Send mail here
    }

    }

    With this approach you can not send the password if you use the hashed version in the DB.

    If members sign up on the website, then you could also just send a mail after they finish the signup process. Then the password would probably be available from the textbox.

  • Evan 344 posts 99 karma points
    Apr 20, 2009 @ 20:46
    Evan
    0

    I am using v4.0.1 and the passwords are hashed. I am not allowing users to sign up on the site, the admin will manually create the users. After the user is created I would like to have an email sent out that will give the user their username and password to log into the site.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 12x admin c-trib
    Apr 20, 2009 @ 21:03
    Jan Skovgaard
    0

    Hi

    I am not sure that this is actually 100% possible using Mortens suggest approach at the moment. I think this bug http://umbraco.codeplex.com/WorkItem/View.aspx?WorkItemId=21611 prevents it at the current time. But I hope this bug is fixed with the upcoming 4.0.2 release.

    I'm having a similar project where I was hoping to do some of the same stuff.

    This post could also be of relevance on how to write the code when the bug is fixed I think.
    http://forum.umbraco.org/yafpostst8622MemberAfterNew-event-doesnt-trigger-MemberNewEventHandler.aspx

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Apr 20, 2009 @ 21:56
    Morten Bock
    0

    [quote=Ewatkins]I am using v4.0.1 and the passwords are hashed. I am not allowing users to sign up on the site, the admin will manually create the users. After the user is created I would like to have an email sent out that will give the user their username and password to log into the site.[/quote]

    Since you are using hashed passwords, i don't think you will be able to send out the password, since you cannot decrypt it.

  • Paul Blair 466 posts 731 karma points
    Apr 21, 2009 @ 05:26
    Paul Blair
    0

    You might be able to capture the event when the admin creates the account and obtain the password before it is hashed.

    Are you using the .NET membership controls?

  • Niels Hartvig 1951 posts 2391 karma points c-trib
    Apr 21, 2009 @ 09:12
    Niels Hartvig
    0

    As passwords are hashed there's - thank god - no way to send the correct password via Umbraco's APIs. This is the way it should be.

    What you would be looking at is creating your own create member control that would use the Umbraco APIs to create the Member and send the e-mail afterwards (without the use of events). As you got control over the form you could get the value of the password directly from the Textbox where it's not hashed as opposed to the APIs where it's returned hashed.

    Cheers,
    Niels...

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies