PHP Programming Part 7: Sending Email with PHP

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Okay, so the reason this may not work for some, and what Eli didn't really explain properly is:

A) you can only use a FROM email address with a domain hosted on the same server as the script. What Eli says at 17:50-18:10 is wrong. The email can be made up/random only if it ends in a domain you own, that is, a domain hosted by the server that's hosting the php script. You can't, for instance, use a paypal email or your own gmail email. Eli's version worked because his made up email still ended in elithecomputerguy[dot]com

B) You may be wanting to let users input their email address so you can respond to them. Therefore you have to use the "Reply-To", not "FROM." Reply-To can use any email you want whereas FROM can only be from a domain you own. The script will send the email from the FROM email, but when you reply your response will go to the Reply-TO email.

C) B may sound confusing because Eli didn't go over why we use FROM. FROM is really part of mail()'s header parameter, which in addition to FROM can also take CC, BCC and Reply-To. FROM is optional ONLY if you don't use any of these other headers.

D) Therefore If you want to use Reply-To, you HAVE to also use FROM. Both can go in one variable but when using more than one header in one mail() function you have to separate them with "\r\n" (don't worry about why).


Hope this helps. I only learned how because I also got trapped, used another tutorial and realized this video was a tad bit misleading. I still like the videos, but yeah....

fundifferent
Автор

man, you should get the Nobel Prize for making this formative tutorials. In time, this can cause revolutionary changes in technology.

Swelliem
Автор

I am stopping your video for a moment to let you know that you are awesome. Awesome teacher, awesome at making things such that the average person, like myself, can do this. Thanks !!

RobertsFamilyVideo
Автор

Hey Eli. Your classes are way better than Team Tree House.com. I seen their ad and purchased a month. Tried it and found you. Your video's are simple, easy, and the info is well put. Thanks.

JJ-bmxi
Автор

Brilliant at teaching. You need to create a track for MySQL, Javascript and Python. You are the chosen one.

sankyeat
Автор

Eli you have done the impossible, and that is getting me to understand PHP wow!! Thank you!

NobleTV
Автор

OK, so I just spent 20 minutes trying to figure out WHY this did not fully work for me. I deleted the print line and tried it again and the email sent. Then i added JUST the 'your message gas been sent and closed it with the ";" and it worked again while displaying the message. Then I tried again with the variables. No luck. So I figured that it was something server specific. ELI, if you are reading this, I want to say very loudly THANK YOU. I'm learning more from you and a lot cheaper than going to college. Thank you again ELI.

bighathosting
Автор

I tried to explain why this will not work for some people and why it's a tad bit misleading but I guess my explanation was too long and my comment won't show.  Basically what he says 17:50-18:10 is wrong. I wish I could provide a better explanation but it will be blocked. In sum: FROM can't be any email. it has to end with a domain hosted on the same server as the script.  So you can' t use a gmail email or anything like that. You have to use something random at yourdomain dot com. If you want the user to submit their email with the form so you can reply to it, you have to use Reply-To in addition to FROM. YOu will have to google mail() reply-to to learn how to do this or Eli will have to make a corrected/clearer video. I can't post it here...

fundifferent
Автор

You are the man, Eli. I watched your 11 videos. I changed my GoDaddy hosting from a Windows to Linux. My website form submissions all failed. I was able to go over this video and successfully re-wrote the program to work with my forms. I didn't want to use the prebuilt stuff (substitute crap) GoDaddy gives you to use.

compcitizen
Автор

Why would you ask them for their email address then send it back to them what sense that make location 18:28 I keep re-winding and it makes no sense

xzatech
Автор

Eli "The Rockstar!" Awesome tutorial....

dmh
Автор

I just wanted to let you know that you used </p> at 23 minutes without an opening <p> in the print function of the email_script.php.

chrisadams
Автор

Thanks this is the first one that worked now I will just style my form

jamiemccallum
Автор

Awesome you are... i just love your videos ..you are so so good in explanation.. Thank you teacher!

prabhakaranj
Автор

Really helpful, I appreciate your work sir.

syedsaqib
Автор

I like how you mentioned about hosting a server at home such a LAMP server and email services not being installed. I personally have a server set up and I host websites for small business and my personal Wordpress sites. One my sites required subscribers to sign up to comment and interact with the site, but I needed it to send out confirmation emails. I want to tell people. Setting email up is a huge pain the ass. My server is an old HP desktop, its loaded with 4GB of RAM a Pentium 4HT processor. Ubuntu 12.04 and ZPanel (It's now been forked and will now be Sentora) But I want to warn you people, if you take on that adventure, you better sacrifice a week of time learning how it works. It didn't neccessarily take me a week. Well figuring out email did. I ended up using MSMTP to send out emails. I also have GoDaddy account I share with a friend of mine. I have email addresses there for some of my domains. I made a small domain and told MSMTP to use that email address account and use GoDaddy's SMTP servers. So my server renders the email, then pushes it to GoDaddy's SMTP server for distrubution to whatever email address it goes to. Simplest way and I have never had an issue since. ZPanel is nice as it does all the hard work setting up PHP, MySQL, Apache, Postfix, ProFTP. Also it has a nice control panel. It's opensource version of CPanel essentially but its free and works beautiful. I can host multiple domains with the power of VHosts. But it does all the hardwork. If you guys really want to run your own server and host these PHP scripts, do something like I did!

codycrislip
Автор

I appreciate the way you teach, thank you

airibey
Автор

The closing </form> tag is missing! Has anyone else noticed?

petersz
Автор

Hey Eli I want to automatically send my entire Mysql database in PDF format to 4 e-mail addresses then automatically truncate my database to start fresh again on another date. I am thinking Cron would be the best method as the e-mail addresses exist on the server I am storing the database on. This will happen every Tuesday and Thursday at 4:10pm. It is basically for registration to an event instead of calling in on a landline. Thanks for the great information so far.

Greydad
Автор

Wouldn't the user want to put their email rather than to a specific email?

Dexterx