Linux serverNETWORK ADMINISTRATIONSsmtp server liux

Send Email from localhost with PHP using PHPMailer and Gmail SMTP server

In this video we are going to create a contact form, and we will
using PHPMailer and Gmail’s mail server to send emails from
our localhost server.

Download PHPMailer from Github:
https://github.com/PHPMailer/PHPMailer

Create an Google App Password:
https://support.google.com/accounts/answer/185833?hl=en

You can buy me a coffee and get the whole source code in a zip file.
https://www.patreon.com/Digitalfox13/shop/send-email-in-php-using-phpmailer-and-140922?utm_medium=clipboard_copy&utm_source=copyLink&utm_campaign=productshare_creator&utm_content=join_link

Read the article, on my website:
https://digitalfox-tutorials.com/tutorial.php?title=Send-Email-in-PHP-using-PHPMailer-and-Gmail

source

by Digital Fox

linux smtp server

22 thoughts on “Send Email from localhost with PHP using PHPMailer and Gmail SMTP server

  • hi i am getting this erro can you help me?

    (Fatal error: Uncaught PHPMailerPHPMailerException: SMTP Error: Could not authenticate. in C:xampphtdocsemailPHPMailerPHPMailersrcPHPMailer.php:2261 Stack trace: #0 C:xampphtdocsemailPHPMailerPHPMailersrcPHPMailer.php(2058): PHPMailerPHPMailerPHPMailer->smtpConnect(Array) #1 C:xampphtdocsemailPHPMailerPHPMailersrcPHPMailer.php(1687): PHPMailerPHPMailerPHPMailer->smtpSend('Date: Sun, 5 Ma…', '–b1=_KZlUsTUlt…') #2 C:xampphtdocsemailPHPMailerPHPMailersrcPHPMailer.php(1521): PHPMailerPHPMailerPHPMailer->postSend() #3 C:xampphtdocsemailPHPMailerscript.php(49): PHPMailerPHPMailerPHPMailer->send() #4 C:xampphtdocsemailPHPMailerindex.php(8): sendMail('stha@gm…', 'test', 'this is test em…') #5 {main} thrown in C:xampphtdocsemailPHPMailerPHPMailersrcPHPMailer.php on line 2261)

  • Got an error from index.php that I can't call the sendEmail function? I put require to link my script.php but still error. Where did I go wrong?

  • This is like 10th video that does not work. Is there working contact form in 2024 or do i need to use wordpress ? thanks

  • after literally days or researching and frustration, finally one tutorial that actually works on Mac and Xampp, and Gmail using this SMTP method. Thank you so much!

  • After submitting the form the email goes to the email address that the end-user enters in the form, not my gmail address. I double-checked everything and I didn't notice anything out of the ordinary. Please advise, thanks.

  • sir i have error plss help
    Fatal error: Uncaught PHPMailerPHPMailerException: SMTP Error: Could not connect to SMTP host. Connection failed. stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages: error:0A000086:SSL routines::certificate verify failed in C:xampphtdocsPHPPHPMailersrcPHPMailer.php:2252 Stack trace: #0 C:xampphtdocsPHPPHPMailersrcPHPMailer.php(2062): PHPMailerPHPMailerPHPMailer->smtpConnect(Array) #1 C:xampphtdocsPHPPHPMailersrcPHPMailer.php(1689): PHPMailerPHPMailerPHPMailer->smtpSend('Date: Sun, 24 M…', '–b1=_25be4AYL5…') #2 C:xampphtdocsPHPPHPMailersrcPHPMailer.php(1523): PHPMailerPHPMailerPHPMailer->postSend() #3 C:xampphtdocsPHPscript.php(136): PHPMailerPHPMailerPHPMailer->send() #4 C:xampphtdocsPHPindex.php(7): sendMail('johncarlovictor…', 'gdagda', 'gdagda') #5 {main} thrown in C:xampphtdocsPHPPHPMailersrcPHPMailer.php on line 2252

  • Nice video, i sure it can help me get a better grade for my project

  • I see a lot of tutorials that show us how to send emails from the same adress, but how to do this with 2 adresses ??

  • Firstly thank you for such a great video. I downloaded the source code from your page a I could not get it to work properly when I entered the code myself it kept on telling me email sent successfully when i opened the page. Now the page will not open and i notice that the code for the index.php is not the same as you have on the video. It does not have the validation test only the submit. Have I done something wrong?

  • Do I need to change something in my localhost Php.ini file?

    I'm getting this error
    Fatal error: Uncaught PHPMailerPHPMailerException: SMTP Error: Could not authenticate. in C:xampphtdocstestPHPMailersrcPHPMailer.php:2265 Stack trace: #0 C:xampphtdocstestPHPMailersrcPHPMailer.php(2062): PHPMailerPHPMailerPHPMailer->smtpConnect(Array) #1 C:xampphtdocstestPHPMailersrcPHPMailer.php(1689): PHPMailerPHPMailerPHPMailer->smtpSend('Date: Mon, 19 F…', '–b1=_mhQuqAu8y…') #2 C:xampphtdocstestPHPMailersrcPHPMailer.php(1523): PHPMailerPHPMailerPHPMailer->postSend() #3 C:xampphtdocstestscript.php(136): PHPMailerPHPMailerPHPMailer->send() #4 C:xampphtdocstestindex.php(7): sendMail('castroroyfranci…', 'TEST VERIFICATI…', 'TEST EMAIL') #5 {main} thrown in C:xampphtdocstestPHPMailersrcPHPMailer.php on line 2265

  • great tutorial! do you use xampp to run it on locahost? because, i have a problem, when i press submit to send the email, it loads infinitely and i don't get a success or fail message, any ideas what the issue could be?

  • NO TENGO PALABRAS PARA DESCRIBIR LO QUE ME AYUDO TU VIDEO, MUCHISIMAS GRACIASSSSSSSSSSSSSSSSSSSSS

  • I'm so thankful to you!!! If you have a donation link, just link it below I just wanna express my gratitude. thank you thankyouuuu. U earned a subscribe!!!

  • It's not working on live server..using GoDaddy hosting… please help

  • Thank you so very much sir. Please, may I ask, did you make any settings changes in your php.ini file?

Comments are closed.