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TnAum#IPJLſC ڎcb#ؼs,L@eȊeNx JV#5?$]㐻 =_?/b3ơf)r8΃z - MxUd^?Uܛc;HUx*3TIQ- !J*,@1($&Bj?H/ͽtB~^6TaJ?aFGQFKۇ9ZYœD*ГwGL$ iˠDD8<X~G,agBg "K-xǻGZZGxK\7G'B7ycь ߺ;,DvQ(Ě٧!)=9b0ƑHR]ɠs(:%\;3ueU ŽR%ѿ'3;y+,ԗ[j5 R k*[$Z{Mݓ kfȔO-0n8^ϲn< 8!'2Y4Z?v5Ld$Z^nΖXoU6iJSb“Bhea?dԂ MvA@ɻ^=_n=MKGL)M>9Lmle3H6-RˀNRIVƞ09mH)d3v-0]Kw3kz]ؒ"agN}>Lqz,T2 d6fiS͈V"@S9fRç9ԇM@T+kuɁ& t')i7&F)4 jj2Џ{6#ZM ?weԴb0|؆Wʣ[*þ ٣} u)/l1tIcU@YWAr晋6le, find the [mail function] section and replace it with the following directives:

sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
  • Edit the sendmail.ini file in the sendmail\ subdirectory of your XAMPP installation directory. Within this file, find the [sendmail] section and replace it with the following directives:

    smtp_server=smtp.gmail.com
    smtp_port=465
    smtp_ssl=auto
    error_logfile=error.log
    auth_username=your-gmail-username@gmail.com
    auth_password=your-gmail-password

    Remember to replace the dummy values shown with your actual Gmail address and account password.

  • Restart the Apache server using the XAMPP control panel.

  • You can now use PHP’s mail() function to send email from your application. To illustrate how it can be used with your Gmail account, use your text editor to create an example script named sendmail.php in the htdocs\ subdirectory and fill it with the following code. Once done, save your changes.

    <?php
    $to = 'recipients@email-address.com';
    $subject = 'Hello from XAMPP!';
    $message = 'This is a test';
    $headers = "From: your@email-address.com\r\n";
    if (mail($to, $subject, $message, $headers)) {
       echo "SUCCESS";
    } else {
       echo "ERROR";
    }

    Remember to replace the dummy values shown with valid email addresses. For this simple test, use your own email address as the recipient address.

    Now, browse to the URL http://localhost/sendmail.php to execute the script and send the email message. If all goes well, you should see a success notification in your browser. If you used your own email address for the recipient address, you should also receive the email message.

    image1

    To configure XAMPP to use PHPMailer for email notifications, follow these steps:

    1. Download PHPMailer from its Github repository using the "Download Zip" button.

      image2
    2. Create a directory for your new application within the htdocs\ subdirectory of your XAMPP installation directory. In this tutorial, the application directory is named example\.

    3. Extract the contents of the PHPMailer ZIP archive to the application directory.

    You can now use PHPMailer to send email from your application. To illustrate how it can be used with your Gmail account, use your text editor to create an example script named phpmailer.php in the application directory, and fill it with the following code. Once done, save your changes.

    <?php
    require 'PHPMailer-master/PHPMailerAutoload.php';
    $mail = new PHPMailer;
    $mail->isSMTP();
    $mail->SMTPSecure = 'ssl';
    $mail->SMTPAuth = true;
    $mail->Host = 'smtp.gmail.com';
    $mail->Port = 465;
    $mail->Username = 'your-gmail-username@gmail.com';
    $mail->Password = 'your-gmail-password';
    $mail->setFrom('your@email-address.com');
    $mail->addAddress('recipients@email-address.com');
    $mail->Subject = 'Hello from PHPMailer!';
    $mail->Body = 'This is a test.';
    //send the message, check for errors
    if (!$mail->send()) {
        echo "ERROR: " . $mail->ErrorInfo;
    } else {
        echo "SUCCESS";
    }

    Remember to replace the dummy values shown with your actual Gmail address and account password. You should also use a valid sender and recipient address. For this simple test, use your own email address as the recipient address.

    Now, browse to the URL http://localhost/example/phpmailer.php. This should execute the script and send the email message. If all goes well, you should see a success notification in your browser. If you used your own email address for the recipient address, you should also receive the email message.

    image3
    As a security precaution, Gmail will automatically rewrite the From: and Reply-to: headers in your email message to reflect your Gmail address. If you want to avoid this, you must add and validate your custom email address in your Gmail account as a sender. Refer to Gmail’s documentation for more information and important restrictions.