Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Creating an email confirmation

From: ColdFusion Power Workshop

Video: Creating an email confirmation

You are looking at another different example of the Travel Adventures booking form. This particular booking form, is booking form email, and that's exactly what it does. The idea behind this booking form, is that the contents of the form itself will be emailed. So I want to show you how the coding is set up for this booking form, in order to create that email within Cold Fusion.

Creating an email confirmation

You are looking at another different example of the Travel Adventures booking form. This particular booking form, is booking form email, and that's exactly what it does. The idea behind this booking form, is that the contents of the form itself will be emailed. So I want to show you how the coding is set up for this booking form, in order to create that email within Cold Fusion.

There is also an email setting that must be set within the Cold Fusion administrator, and I'll show you where that can be set. So let's take a look at the source code on this particular booking form. I am instantiating a new copy of the Booking Tours component. Calling it CFC Booking Tours. Calling the all tours method. And assigning what's returned from calling that method into the tour listing variable.

This is populating the drop down list that lists the tours within the form. So there's nothing different there from some of the other forms within our booking folder. What is different, is line 21, right here. And what this is doing is calling a method of the CFC Booking Tours, that was the component instantiated up at the top of the page.

But this time, we're calling the email, tour details method, from within that CFC, passing in detour ID. If they have not submitted a tour month within the form, once the form button has been clicked, then they're been redirected back to booking form display. With the month attached as a URL variable.

The booking form display has some coding on it, watching for that URL variable to see if it is within the URL, and if so, it's going to display a message to the user. So, what's going on within this email tour details method, within the Booking Tours CFC that we instantiated? So, I'll open that up, and the email section is what we want. Now within the email tour details method, you can see there's a fair amount of information.

First of all, it's going to be receiving an argument. The name of that argument is going to be display filter. We are using the CF Save Content tag, and what that does is take everything between opening and closing tag, and assign it to this variable name. So the idea is, Cold Fusion will process all of this information in between the save content. Once it's been processed, it goes into this variable name. And ultimately, you'll see that variable name is plugged into this text area within our CF log.

It's also plugged into, the, information within our Cold Fusion or our CF mail tag. So this variable comes in very handy. And what this doing is, running the query, pulling out the tour information. It's populating that into a nice little message for the user, and all of that information is going into the log as text.

Now once that log has been created, we're working with the CF mail tag, and that is an opening and closing tag. Whatever is in between that tag, which is our variable, created up above, of all of this information, that will become the body of the email. Within the CF mail tag, we're going to to take the user's email address that they plugged into the form, and use that as our from. This information will go to the info@poweradventures.com email address, this is a fake email address.

The subject is going to be booking details. So once the user fills out the form, this is method is called, and within the method an email is sent. So, that's exactly what this method does. Now, in order to have this CF mail take work correctly, what we need to do, is go out to the servers, and I'm going to launch the administrator. Now when I did that, this likes to pop up rather high.

And I'll right-click, launch the administrator, and I'll show you where the mail, or email portion is located within the administrator. And it's right within this area called mail. Now your mail will not work unless you specify an SMTP server here. And if you need authentication, which most SMTP servers need, you plug in your username and password. So this is your mail server.

This information this SMTP address, is the same address you would plug into your phone if you're going to get email via phone, or in Outlook, or some Mac mail program for your email on your system. I tend to find Windows users, tend to fall back to Outlook, but Mac users tend to use a couple of different programs in order to setup their email on their system.

So whatever you would plug in to your regular email, that would go in here. And it's your SMTP server, standing for send mail. So this just sends email, it doesn't receive any. And if this is not set, even if your code is perfect within your page, this email will not be sent. So that is the booking form email, and the coding for it. I don't have that SMTP server set up, officially.

I don't want to be sending an email to info@poweradventures. So if you decide to set this up, please change this email address, to your email address specifically, so that you will know that you've received it. But that is how you can create a booking form, or any type of a form, set it up to work with a component method. Put that email information into both analog, and shoot off an email using the Cold Fusion server.

Show transcript

This video is part of

Image for ColdFusion Power Workshop
ColdFusion Power Workshop

39 video lessons · 911 viewers

Candyce Mairs
Author

 
Expand all | Collapse all
  1. 1m 35s
    1. Welcome
      1m 35s
  2. 41m 29s
    1. ColdFusion installation
      9m 2s
    2. Installing ColdFusion Builder
      5m 41s
    3. Setting up the course files
      2m 0s
    4. ColdFusion Builder project setup
      7m 25s
    5. ColdFusion 10 Administrator enhancements
      6m 50s
    6. Setting up the database
      2m 30s
    7. Creating an Apache Derby data source
      4m 25s
    8. Customizing the ColdFusion Builder interface
      3m 36s
  3. 49m 50s
    1. What is the application framework?
      3m 20s
    2. CFC placement
      6m 47s
    3. Planning event code
      6m 28s
    4. Initializing application-level variables
      10m 14s
    5. Application methods
      6m 51s
    6. Triggering application methods
      8m 14s
    7. Request methods
      7m 56s
  4. 39m 45s
    1. Levels of error handling
      3m 50s
    2. Adding a site-wide error handler
      8m 22s
    3. Creating error templates
      8m 40s
    4. Using the error templates
      8m 31s
    5. Adding the onError method
      8m 15s
    6. Additional tips on error handling
      2m 7s
  5. 36m 6s
    1. What is a CFC?
      4m 50s
    2. Creating a static CFC
      8m 11s
    3. Calling a static CFC
      6m 47s
    4. Creating an instance-based CFC
      7m 16s
    5. Invoking an instance-based CFC
      9m 2s
  6. 28m 3s
    1. Reviewing the booking form
      7m 42s
    2. Working with the booking area component
      8m 33s
    3. Submitting the booking form
      7m 20s
    4. Controlling client-side form validation
      4m 28s
  7. 24m 10s
    1. Displaying the booking details
      8m 49s
    2. Inserting the booking form data
      7m 21s
    3. Creating an email confirmation
      8m 0s
  8. 29m 17s
    1. Using the cfproperty tag
      6m 20s
    2. Coding an instance-based component
      7m 23s
    3. Running the instance-based component
      7m 28s
    4. Calling a method from a URL
      4m 33s
    5. Calling a method from a form
      3m 33s

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed ColdFusion Power Workshop.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.