Wednesday, January 13, 2021

Create a PHP Send Email Contact Form - using PHPMailer - Step by Step



Description


Hello everyone! In this video, you are going to learn step by step how to create a contact form to send an email to a specific email address using PHPMailer.


There is a web page on a website that allows users to make contact with the site owner called the contact page. The page has fields for filling in email, name, message and etc. On most websites, email and mail addresses are also included as more info. however, the contact form provides major space, convenient way for users to communicate with the site owner for this purposes.


Lets see how to do it according to this tutorial. First yo need to download the PHP mailer from github. Then extract that file and copy the file to the folder that you created in htdocs. Watch the video for more details. Then you have to do a important step In your gmail account (the gmail account that you are going to use to send emails) go to your account settings and in the security tab you can see "less secure app access ". In default it is turned off and you need to turn it on. It's important. then start the apache server on your localhost. Then start to code. In the index.php file you need to create the contact form . The code the sendEmail.php file (follow the video). I think it is not hard to follow. Hope this video will be helpful to create a contact form to send emails using your gmail account.



All the source codes and source files and available to download from here. Use the download button or copy and paste the code from the text editors. My opinion is first try to do it by following the video line by line. It will help you t o understand all of it. After that, if your code is wrong or not working use the given source codes to compare with your code. It will help you to understand all of your mistakes.


Source Codes For Create a PHP Send Email Contact Form


index.php



sendEmail.php



Download Source Files

We only allow you to publish relevant and respectful comments. Vulgar, hateful, or spam comments will be removed.

  1. Hello, very good tutorial! I wanted to know if instead of replacing a css style I could replace one class with another? And what would the structure be like?

    ReplyDelete
  2. hello thank you for evey think
    but code does not runing into my laptop

    ReplyDelete
  3. that's coz you haven't turn on

    ReplyDelete
  4. this code doesn't work on live

    ReplyDelete
  5. Is there a way I can convert to this program to send emails to a list of email addresss?

    ReplyDelete
  6. Thanks (from Bangladesh)😘

    ReplyDelete
  7. Thank you so much! Finally found a way to send contact form information through mail by following this tutorial! You're amazing!
    May I ask if you have any ideas about how to send attachments this way? Or have you done any other tutorials I can follow for something similiar to that?

    ReplyDelete
  8. Hey, thanks for the tuto. Its really helpfull
    The form is working for me if and only if i dont have a '@' in the email input
    Do you know how where it can coming from or how to have a return of the error ?
    Cheers, Julien

    ReplyDelete
  9. Hello, this tutorial works like a charm. Thank you so much for that.

    However, I cannot modify it to suit my need. I want to only let people send their name and email address, but every time I remove the subject and message box it will not send anything to my email. How can I achieve so?

    ReplyDelete

Whatsapp Button works on Mobile Device only