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

PHP email

From: Dynamic Dreamweaver Websites: Creating and Validating Forms

Video: PHP email

Now I want to show you how to build the actual PHP information that's going to create the email, and I have a file in here, an extra file in the Chapter Seven start course files. So if you do not have those presently, please replace the scuba vac files folder inside of either zamp or mamp in the HT docs folder. Please replace your version of that folder with the chapter seven start version.

PHP email

Now I want to show you how to build the actual PHP information that's going to create the email, and I have a file in here, an extra file in the Chapter Seven start course files. So if you do not have those presently, please replace the scuba vac files folder inside of either zamp or mamp in the HT docs folder. Please replace your version of that folder with the chapter seven start version.

There are a few additional files that have been added within the chapter seven start files, and those are the ones I'm going to be talking about. I'm going to open up a file called testemail.php. And we're just going to look at the code on this page, but here is how you can use this file. I put this in the Course files. This is an accurate working model of sending an email.

The idea is you get this on your server, you enter your email address in two locations. Enter it here and enter it here and all you have to do on your web server is open this file in the browser and you should receive an email with a subject of test and the body of the email should say this is a test email. This file will allow you to test and make sure that the email is working on your web server. The reason I'm doing that is because in a local host environment. In a development environment like we are working in. Testing emails usually does not work.

The web server is what sends an email. It is not PHP that sends the email. So this message you're looking at is simply gathered up by PHP. And forwarded using the mail function. This is forwarded to the male transport agent, or MTA. Within your web server and that portion is what actually sends the email. So PHP doesn't have direct contact with the email portion, it's the web server that actually sends the email.

So this file will give you a chance to test your email make sure you're actually receiving your email, before you take a look at the Contact Us form. Now, there are a lot of things that can occur, in trying to send an email. A lot of issues, things such as spam filters, can prevent an email from being received. And your SMTP server, your web server itself, may have to be configured. So our local environment, we cannot use to test emails, or at least not accurately.

So your development environment, if you open this file in the browser, nothing will happen. If you put this on a live web server thats actually functioning and has an smtp server set up within it this will work perfectly. So actually sending thee email is a difficult process in the development environment and what you're going to want to do is get it onto a live web server in order to accurately test it. So here's a very basic form. All this code is correct.

If this does not email, then there's something wrong on the web server side. But do not try and do this in the local environment. Now, this particular feature, what we're doing is setting up our To, Subject, Body, the headers is going to list who this is from. And this is what actually puts the email message together. So this mail function has four pieces separated by commas and your standard php semicolon at the end. This goes inside of php tags.

So the php email portion It's pretty simple. It's really just this line of code. Every other line of code is building those different pieces within this parentheses area. When we look at our Contact Us final form version, this same mail function will be working. But it will be populated with the form data, so we'll take a look at that in another movie. Just note, this test email can used, make sure you put your email address in line two, where it says to do so, and line three, where it says to do so between the quotes.

The double quotes specifically. If you run this and you get an email, your email system is working correctly so your Contact Us final version from the scuba vacations website, if you put that on your server it should work correctly as well.

Show transcript

This video is part of

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 Dynamic Dreamweaver Websites: Creating and Validating Forms.

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.