How to send email to site Admin when a new user registers?

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: May 2007
Posts: 38
Reputation: matale is an unknown quantity at this point 
Solved Threads: 1
matale matale is offline Offline
Light Poster

How to send email to site Admin when a new user registers?

 
0
  #1
Jul 23rd, 2008
Hi,
Im using ASP.net Login controls to allow users to Register on my website. I want an Email to be sent to the site Administrator everytime a new user registers, how do I achieve this?
Thanx
Last edited by matale; Jul 23rd, 2008 at 4:34 pm.
My current Project www.footystat.com
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 370
Reputation: greeny_1984 is an unknown quantity at this point 
Solved Threads: 29
greeny_1984's Avatar
greeny_1984 greeny_1984 is offline Offline
Posting Whiz

Re: How to send email to site Admin when a new user registers?

 
0
  #2
Jul 24th, 2008
  1. void SendMailToStudent()
  2. {
  3. MailMessage stdmsg = new MailMessage("from@co.org", "to@co.org");
  4. SmtpClient smtp = new SmtpClient();
  5.  
  6. stdmsg.Subject = "Acknowledgement for Student Application";
  7. stdmsg.IsBodyHtml = true;
  8.  
  9. stdmsg.Body = "";
  10. stdmsg.Priority = MailPriority.High;
  11.  
  12. smtp.Host = "localhost";
  13.  
  14. // StdMsg.Subject = "Acknowledgement for Student Application";
  15. //stdmsg.IsBodyHtml = true;
  16.  
  17.  
  18. try
  19. {
  20.  
  21. smtp.Send(stdmsg);
  22. }
  23. catch (Exception ex)
  24. {
  25. lblAgmtMsg.Text = "Error : " + ex.Message;
  26. }
  27. }
u can use this to send mail
Last edited by Tekmaven; Jul 24th, 2008 at 3:20 am. Reason: Code tags
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 38
Reputation: matale is an unknown quantity at this point 
Solved Threads: 1
matale matale is offline Offline
Light Poster

Re: How to send email to site Admin when a new user registers?

 
0
  #3
Jul 24th, 2008
Originally Posted by greeny_1984 View Post
  1. void SendMailToStudent()
  2. {
  3. MailMessage stdmsg = new MailMessage("from@co.org", "to@co.org");
  4. SmtpClient smtp = new SmtpClient();
  5.  
  6. stdmsg.Subject = "Acknowledgement for Student Application";
  7. stdmsg.IsBodyHtml = true;
  8.  
  9. stdmsg.Body = "";
  10. stdmsg.Priority = MailPriority.High;
  11.  
  12. smtp.Host = "localhost";
  13.  
  14. // StdMsg.Subject = "Acknowledgement for Student Application";
  15. //stdmsg.IsBodyHtml = true;
  16.  
  17.  
  18. try
  19. {
  20.  
  21. smtp.Send(stdmsg);
  22. }
  23. catch (Exception ex)
  24. {
  25. lblAgmtMsg.Text = "Error : " + ex.Message;
  26. }
  27. }
u can use this to send mail
Maybe I didnt explain correctly. The question is how do I trigger the sending of the email when a user registers on my site, using the UserRegistration Wizard? Meaning how do I detect the successul registration of a user and call the SendMailToStudent Function
My current Project www.footystat.com
Reply With Quote Quick reply to this message  
Join Date: May 2007
Posts: 38
Reputation: matale is an unknown quantity at this point 
Solved Threads: 1
matale matale is offline Offline
Light Poster

Re: How to send email to site Admin when a new user registers?

 
0
  #4
Jul 24th, 2008
Ok I think I found it. The CreatedUser event is raised everytime a new user registers, so i can stick the code in there.
thanx
My current Project www.footystat.com
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 370
Reputation: greeny_1984 is an unknown quantity at this point 
Solved Threads: 29
greeny_1984's Avatar
greeny_1984 greeny_1984 is offline Offline
Posting Whiz

Re: How to send email to site Admin when a new user registers?

 
0
  #5
Jul 26th, 2008
mark the thread as solved
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC