Automatically send email upon registration
Ever want to send an automatically generated welcome email to a newly registered member upon the completion their
registration?

Well here is a simple example how to accomplish that task.

OK first all you have your registration form and the action page for that form where data is
inserted into the DB like this..

------------------------------------------------------------------------------------------------------------------------
<!---This is the registrationACTION.cfm page,,,,arrived to by the registration.cfm page--->

<!---This form sends the user a welcome email that contains their Log-In credentials and a
email address they can use to contact someone for assistance--->

<!---Insert new user info in DB--->

<CFLOCK type="exclusive" timeout="10">
      <CFINSERT datasource="#REQUEST.DSN#" tablename="usesr">
</CFLOCK>

<!---Now we use the <CFMAIL tag and some of the form info provided to create the welcome email that
sends the users log in credentials and sitmanager email info--->

<!---Now start the email, be sure to include the type="html" attribute so you can include html tags--->

<cfmail to="#FORM.Email#" from="#APPLICATION.MgrEmail#"
subject=
"Welcome to PhotoShare!!!" type="html">

<p align="center">
    Welcome to PhotoShare, a BlueFly DataDesign production.
</p>

<p align="center">
    <BR>
    Here is your user info<BR>
</p>

<div align="center">
   <strong>
      Email Address to log-in with:
   </strong>
   <span class=
"style2">
      #FORM.Email#
   </span><BR>
   <strong>

      Password:
   </strong>
   #FORM.Password#<BR>
</div>

<p align="center">
   Thanks again for joining our site and if you have any questions please contact me at:
</p>

<p align="center">
   <a href="mailto:SiteManager@blueflydatadesign.com">
     SiteManager@blueflydatadesign.com
   </a><br>
</p>

<p align="center">
   <font size="-1" color="##FF0000">
   <I>

        This email is sent automatically upon
        registering with our site. Please do not respond to this email.
        If you require assistance please
        click on or use the Site Manager address specified above.
   </I>
   </font>
</p>

</cfmail>

</cfoutput>

<!---Now send them back to the home page so they can begin the experience as a member of your site--->

<cflocation url="index.cfm">
---------------------------------------------------------------------------------------------------------------------

As you see above we use the FORM. variable created by submission of the user sign-up form.

Use the #FORM.Email# field as the "to" attribute of <CFMAIL>

Use the #FORM.Password# field from the submission form to insert into the email.

All ColdFusion Tutorials By Author: Michael "Newkirk" MacDonald
Download the EasyCFM.COM Browser Toolbar!