ASP.Net 2.0 CreateUser Email Confirmation
Create User Wizard Control of ASP.Net Membership service also provides the email confirmation service. You can send confirmation email at the registered email-id of newly registered user. If you will scroll down the properties of CreateUserWizard control you will get a property group as MailDefinition. MailDefinition is a set of properties:
-
BodyFileName
-
CC
-
EmbeddedObjects
-
From
-
IsBodyHtml
-
Priority
-
Subject
BodyFileName
BodyFileName property gets/sets the path of a file containing the body content for the email message.
CC
CC property gets/sets the comma-delimited list of email address to receive the carbon-copy of email message.
EmbeddedObjects
EmbeddedObjects is collection of mail objects like images that can be embedded in the body of email message.
From
From property gets/sets the email address of sender.
IsBodyHtml
IsBodyHtml property gets/sets the value as true/false indicating the type of content. Set it as true if you are sending HTML body content or set it false if you are sending a plain text email message.
Priority
Priority property gets/sets the priority of email message. It is an enum type that sets the priority as High, Low or Normal.
Subject
Subject property gets or sets the subject of email message.
You can use <%UserName%> and <%Password%> to send the username and password of the registered user in body content of email message.
Smtp Settings for Email Confirmation
To send confirmation email with CreateUser Wizard Control you have to smtp mail setting in the web.config file of your ASP.Net web application. Following code can be used to configure the SMTP settings:
<system.net>
<mailSettings>
<smtp from="example@example.com">
<network
host="mail.example.com"
password="securepassword"
userName="example@example.com" />
</smtp>
</mailSettings>
</system.net>
Paste the above code just below the closing </system.web> section to configure the mail settings. If your smtp server requires authentication then you have to pass the password and username values in the above smtp settings otherwise leave them blank e.g.: password="" username=""
Set the smtp host as the mail host address of your domain.
CreateUser Wizard Control will automatically use these SMTP host settings to send the confirmation email.
Continue to next tutorial: ASP.Net 2.0 Password Recovery Control With Email to learn how to create forgot password form along with email recovery feature.
