Ala
Ala

Reputation: 3

How I can Send confirmation email on new customer registration in my asp.net project?

I have my ASP.NET project and I want to add "Send confirmation email on new customer registration" feature on my website.

what should I have do and how? I don't know anything about.. so look at me as kid ^_^.LOL!!

Upvotes: 0

Views: 376

Answers (1)

Paresh Gami
Paresh Gami

Reputation: 4792

When new customer join your site you need to create unique for each customer then make url which is check this token is in your database or not if it is in database it is valid user if not it is not valid token or valid customer.

You need to send this token to mail of joined customer's email address. using following code.

SmtpClient smtpClient = new SmtpClient("mail.MyWebsiteDomainName.com", 25);

smtpClient.Credentials = new System.Net.NetworkCredential("[email protected]", "myIDPassword");
smtpClient.UseDefaultCredentials = true;
smtpClient.DeliveryMethod = SmtpDeliveryMethod.Network;
smtpClient.EnableSsl = true;
MailMessage mail = new MailMessage();

//Setting From , To and CC
mail.From = new MailAddress("info@MyWebsiteDomainName", "MyWeb Site");
mail.To.Add(new MailAddress("info@MyWebsiteDomainName"));
mail.CC.Add(new MailAddress("[email protected]"));

smtpClient.Send(mail);

You need to send one link in email like below.

http://yoursite.com/confirmation.aspx?token=<UNIQUE-TOKEN-GOES-HERE>

If email of customer is valid then email is goes otherwise email is not receive on dummy email. if customer receive email inside email have one link where customer need to click when customer click on link they redirect to your site then you check token is valid or not.

Upvotes: 1

Related Questions