Our Blog

Send Email with PHP

by seeoutlook Blogger


**Word: The online web page incorporates a hyperlink the pattern recordsdata used. **
A easy instance on the way to ship a plain textual content e mail with PHP. Covers the contact type, the e-mail processor, and the thank-you web page.

Please be aware, your net host could put particular restrictions on sending e mail from a PHP script. If it would not give you the results you want, test together with your host.



5,770 comments on “Send Email with PHP”

  1. hAFSA MAT     June 4, 2018

    not working -_-

  2. Merv     June 4, 2018

    I would appreciate if someone could assist me with my php oop codes:

    require_once 'core/init.php'; // we have autoloader here

    $user = new User();
    if(isset($_POST['submit'])) {

    $to = Input::get('email');
    $subject = 'Email activation is required';
    $message = 'Hello' .$user->data()->username.'You must activate your account before logging in. Please activate by clicking on the link here:';

    mail($to, $subject, $message, $headers);


    I can't get it to display the names of the users

  3. Miel Seña     June 4, 2018

    how to do if the user will send an email depending to the department.

  4. Yerkanat Abdizhadilov     June 4, 2018

    What is the name of program that checking the email

  5. Roshan kr soni     June 4, 2018

    I tried your code but I did not get any response. I was followed your all instruction an all thing which you have show in this video so sir please help me how can I develop contact us page is there have another things required so please tell me.

  6. Yash Gupta     June 4, 2018

    Thanks it helps!

  7. Dries Tv     June 4, 2018

    it is not working

  8. Carlos Villamizar     June 4, 2018

    hi, i am very new on this. Have some questions for you.
    Can i have the main contact page in HTML? And can i link contact.html page with contact-us-send.php page? I do not what to do. I tried with this, but showing me http 500 error.

  9. Simon205     June 4, 2018

    someone help please not working


    <h1>contact us</h1>
    <form action "index.php" method="post">
    <label for=" name">Your Name:</label>
    <input type="text" id="name" name="name"/>
    <label for="email">Your Email:</label>
    <input type="text" id="email" name="email"/></li>
    <label for="comment">Your Comment:</label>
    name="comment" id="comment"></textarea>

    <input type="submit" name="submit"
    value="click to send Your comment"/>


    mail('examplemainasimon205@gmail.com','sample contact us form',$msg);
    Simon205 All Rights Reserved. Copyright &copy;<?php
    echo date("Y");?>

  10. Abhishek Sharma     June 4, 2018

    Thank you. I solved my query.

  11. Rk Bishnoi     June 4, 2018

    pleae sent the zip file with coding to my mail id Rommiyokings@gmail.com reply me as soon as possible thanking u

  12. Jonathan Awofeso     June 4, 2018

    It worked!!!! Thank you so much!

  13. Árpád Kardos     June 4, 2018

    Thanks dude awsome video <3 sub foll like

  14. Santosh Reddy     June 4, 2018

    i need small help suppose my project ecollege add mail functionality how to add in functionality plz help me rply fast

  15. arbi asajev     June 4, 2018

    works ty

  16. Justin Hunt     June 4, 2018

    Fantastic video! Easy to follow and I appreciate your explanation of some common PHP nuances. Keep up the GREAT work!

  17. Raven salud     June 4, 2018

    did you upload this in your server to work?

  18. Dennis Fechner     June 4, 2018

    Thank you!

  19. Saumya Mishra     June 4, 2018

    It's work on localhost server or not ?

  20. Mansouri hassan     June 4, 2018

    you put an exemple and you dont put a link for the lib head.php ??????!!!!!!!

  21. Manasi     June 4, 2018

    can you please give me the code of login.php and config.php?
    thank you

  22. Amy Arnold     June 4, 2018

    when you are writing the $msg = 'Name: '.$_POST['name'] …… is that the "id" attribute or the "name" attribute??
    in other words- I have more information that i need to include in the email (like postal code and radio buttons) – so i was wondering which attribute this code is actually reading? so I don't write in the wrong name

  23. Deepjot singh     June 4, 2018

    its not working on me

  24. Hardik Gondhiya     June 4, 2018

    this is simple Great !!
    when i am try to submit the button Thank u page is shown
    but email is not send
    what should i do ?!

  25. kishore kumar     June 4, 2018

    Thank you sooo much sir…

  26. Ratul Ahmed     June 4, 2018

    thank you . you save my life and time

  27. Renukesh Deshpande     June 4, 2018

    How to set the php.ini file for that , do you have a video for that ?

  28. Bilal Gujjar     June 4, 2018

    when i use this code the mail is not received in desired email please help me

  29. Boy Songvath     June 4, 2018

    As expected it doesn't do anything
    if (isset($_POST["submit"]) && !empty($_POST["telefon"]){
    $msg = "Nume: " .$_POST["nume"] ." ". $_POST["prenume"] ."n"

  30. Aliza Khan     June 4, 2018

    i have no hosting can i send gmail without hosting.please tell me where can i run my php file . I want to send my gmail with flash as3 is it possible?

  31. Babylon Gate     June 4, 2018

    Update ……cos the video is kinda old.
    you only need command
    mail($to, $subject, $msg);
    make sure put this line after you create the variables
    $to = "name@yahoo.com";

    you get the Idea

  32. ReallyIni     June 4, 2018

    Which hosting providers allow the php mail function, and which ones don't? Or in other words, with which hosting providers will this code work, and where will it not work?

  33. AmateurYoutuber     June 4, 2018

    As expected it doesn't do anything
    if (isset($_POST["submit"]) && !empty($_POST["telefon"]){
    $msg = "Nume: " .$_POST["nume"] ." ". $_POST["prenume"] ."n"
    ."Email: " .$_POST["email"] ."n"
    ."Telefon: " .$_POST["telefon"] ."n"
    ."Adresa: " .$_POST["adresa"];
    mail("its-better-not-to-show-it-but-its-valid", "Comanda de Magneti", $msg);
    header("location: multumim.php");
    } else if (isset($_POST["submit"]) && empty($_POST["telefon"])){
    $msg = "Nume: " .$_POST["nume"] ." ". $_POST["prenume"] ."n"
    ."Email: " .$_POST["email"] ."n"
    ."Adresa: " .$_POST["adresa"];
    mail("same-thing-here", "Comanda de Magneti", $msg);
    header("location: multumim.php");
    header("location: comanda-magneti.html");
    I have made an else if statement in case the user doesn't enter its phone number.
    It doesn't even bring me to the thank you page after that.
    I didn't use any "require" statements on the previous pages, if that's relevant information. If somebody could help me that would be really cool.

  34. Kuldeep Singh     June 4, 2018

    But, i guess we have to do some changes also in php.ini, sendmail.ini (if using xampp) and something in gmail setting also. Please tell me those configuration as well if possible 😀

  35. UnRatable     June 4, 2018

    Thank you a ton! I've been looking through tutorials and none of them worked apart from yours! They used a different method of making variables and then putting them into the mail() command which sadly did not work for me.

  36. LividProductions     June 4, 2018

    Brilliant tutorial! Nicely explained and simple to do 😀

  37. furtdsolinopv     June 6, 2018

    I like this site very much, Its a really nice position to read and obtain information. “If at first you don’t succeed, you’re running about average.” by M. H. Alderson.


  38. AwvjcOrita     June 8, 2018

    online gambling casino online casino games best online casinos | https://casinorealmoney2018.us.org/ – slots for real money

  39. 17ljzmm1KJ     June 9, 2018

    998694 631173To know wisdom and instruction, to perceive the words of understanding 591246

  40. furtdsolinopv     September 4, 2018

    Simply wanna remark on few general things, The website design is perfect, the content is rattling good. “In business school classrooms they construct wonderful models of a nonworld.” by Peter Drucker.


  41. cupid dating site     October 14, 2018

    I spent four years trying EVERYTHING in Online Dating, and through a huge amount of trial and error, I produced a system that I will share for you. This book will take you, step by step, through everything you need to know to double, triple or even quadruple the number of women you meet online.


  42. click here     December 17, 2018

    Affordable Water Restoration ​​11300 Lindbergh Blvd, Fort Myers, FL 33913​ ​(239) 645-7472

Leave a Reply


Send message