Monday, September 20, 2010

Send Email to Admin on new user creation

Most of what you want to do is already there.  This procedure will activate built-in function to send an email to each new user when they register.  Include a 'welcome, thanks for registering' etc text file.  You will have a copy of this email sent to yourself.
I use visual studio.....
  • Open register.aspx .
  • Have the "properties window" open in visual studio.
  • Click on the wizard that registers users.
    (you may have to click around a bit to get the right 'properties' to show. 
  • Keep an eye on the properties and look for "mail definition"
  • enter a body filename -  mine is ~/textfiles/newuserwelcome.txt
    I click on anything inside the registration wizard, then at the bottom of Visual Studio window I select   thing (is this a tag?) and then the properties that we want to chage will appear.
  • enter the destination email address etc etc. .
  • Create the file ~/textfiles/newuserwelcome.txt  (or whatever you like to call it.
    In this file write
    • welcome <%UserName %>   Thanks for registering
    • your password is <%Password %>  Please write it down and store it someplace SAFE.
  • the website will magically insert the username and his password and send an email to him when he registers.
  • Back in the properties, in 'maildefinition'  put  in the CC field, your administation emai address. 
Be aware that your new user WILL see this address in the email he gets.   I wanted to send a BCC to myself instead, but I have given up on that.    So if one of your new users is unethical and knows more about internet than you, he will want to break into your administrator email address and get access to all those usernames and passwords.   So you should go into this email address and delete all of the occasionally.
If someone knows how to get the site to send a BCC (blind-carbon-copy), I would very much like to know how.

     MailAddress bcc = new MailAddress("somedude@somedomain.com");
   message.Bcc.Add(bcc);

No comments:

Post a Comment