Hi friends in this tutorial i have share the knowledge  how to use php mailler and send the mail to your account using local server(xampp). the are lots of tutorials are available on google but there are some missing points i have saw so know i have create this tutorials for you so lets read the points and start trying to your own pc and laptop.


#PHP MAILLER  SETTINGS#


Step 1:-

Go to Gmail my account and select less secure option that default is Off so u have to On that option.



Step 2:-
Setting your php.ini file
Search Mail function on php.ini file
Change the setting
[mail function]
; For Win32 only.
; http://php.net/smtp
;SMTP=localhost
SMTP=smtp.gmail.com
; http://php.net/smtp-port
;smtp_port=25
smtp_port=587                        //add this port
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = xyz@gmail.com                      // write your email

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path ="\"C:\xampp\sendmail\sendmail.exe\" -t"                        //add this path

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header=On                               //ON MAIL.ADD HEADER


Step 3 :-

Follow the program (I’ll provide the link in description to download the program ). <-
Save file sendEmail.php
<?php
    use PHPMailer\PHPMailer\PHPMailer;

    if (isset($_POST['name']) && isset($_POST['email'])) {
        $name = $_POST['name'];
        $email = $_POST['email'];
        $subject = $_POST['subject'];
        $body = $_POST['body'];

        require_once "PHPMailer/PHPMailer.php";
        require_once "PHPMailer/SMTP.php";
        require_once "PHPMailer/Exception.php";

        $mail = new PHPMailer();

        //SMTP Settings
        $mail->isSMTP();
        $mail->Host = "smtp.gmail.com";
        $mail->SMTPAuth = true;
        $mail->Username = ""; //enter you email address
        $mail->Password = “''; //enter you email password
        $mail->Port = 465;
        $mail->SMTPSecure = "ssl";

        //Email Settings
        $mail->isHTML(true);
        $mail->setFrom($email, $name);
        $mail->addAddress(""); //enter you email address
        $mail->Subject = ("$email ($subject)");
        $mail->Body = $body;

        if ($mail->send()) {
            $status = "success";
            $response = "Email is sent!";
        } else {
            $status = "failed";
            $response = "Something is wrong: <br><br>" . $mail->ErrorInfo;
        }

        exit(json_encode(array("status" => $status, "response" => $response)));
    }
?>

watch full video with steps




Add this folder PHPMailer.

drive links   Download  full program  





Post a Comment

Previous Post Next Post