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

Recommended Answers

All 4 Replies

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

mark the thread as solved

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.