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

void SendMailToStudent()
    {
        MailMessage stdmsg = new MailMessage("from@co.org", "to@co.org");
        SmtpClient smtp = new SmtpClient();
 
        stdmsg.Subject = "Acknowledgement for Student Application";
        stdmsg.IsBodyHtml = true;

        stdmsg.Body = "";
        stdmsg.Priority = MailPriority.High;

        smtp.Host = "localhost";

        // StdMsg.Subject = "Acknowledgement for Student Application";
        //stdmsg.IsBodyHtml = true;


        try
        {
       
            smtp.Send(stdmsg);
        }
        catch (Exception ex)
        {
            lblAgmtMsg.Text = "Error : " + ex.Message;
        }
    }

u can use this to send mail

void SendMailToStudent()
    {
        MailMessage stdmsg = new MailMessage("from@co.org", "to@co.org");
        SmtpClient smtp = new SmtpClient();
 
        stdmsg.Subject = "Acknowledgement for Student Application";
        stdmsg.IsBodyHtml = true;

        stdmsg.Body = "";
        stdmsg.Priority = MailPriority.High;

        smtp.Host = "localhost";

        // StdMsg.Subject = "Acknowledgement for Student Application";
        //stdmsg.IsBodyHtml = true;


        try
        {
       
            smtp.Send(stdmsg);
        }
        catch (Exception ex)
        {
            lblAgmtMsg.Text = "Error : " + ex.Message;
        }
    }

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

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

This article has been dead for over six months. Start a new discussion instead.