Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
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 firstname.lastname@example.org 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.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101328 Viewers
61 Video lessons · 88090 Viewers
71 Video lessons · 71944 Viewers
56 Video lessons · 103758 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
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.
Your file was successfully uploaded.