top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to Send user Confirmation email after Registration in ASP.Net?

0 votes
572 views
How to Send user Confirmation email after Registration in ASP.Net?
posted Apr 27, 2017 by Jdk

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

You can use the below code to send confirmation email to user.

    // Send Email to user email address
    public void Send_Account_Activation_Link(string emailaddress, string act_code)
    {
        MailMessage mm = new MailMessage("Your EMail ID", emailaddress);
        mm.Subject = "Account Activation";
        string body = "Hello " + txtusername.Text + ",";
        body += "

Please click the following link to activate your account
";
        body += "

<a style='background:#000000; color:#fafafa; padding:10px 100px 10px 100px; width:350px; text-decoration:none; font-weight:bold; font-size:20px;' href = '"+ Request.Url.AbsoluteUri.Replaceundefined"Registration.aspx", "Account_Activation.aspx?ActivationCode=" + act_code) + "'>Click here to activate your account.</a>";
        body += "

Thanks";
        mm.Body = body;
        mm.IsBodyHtml = true;
        SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
        smtp.Credentials = new System.Net.NetworkCredential("Your Email ID", "<your email="" password="">");
        smtp.EnableSsl = true;
        smtp.Send(mm);
    }
answer May 3, 2017 by Shweta Singh
Similar Questions
+7 votes

How to create your own controls?
Basic steps will be helpful.

0 votes

When no MTA is installed, How to send an email with a cronjob? I have below entry in my cronjob? My /etc/cron.d/backup file looks like this.

MAILTO=myemail@example.com
15 11 * * * root /root/scripts/backup.sh

Can I send this email via SMTP server?

...