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;mxza#&0EP}'e̊Y0cM@f+#l-z1Gk'w͵5#̎ZsFQ=Ov%Mn? .?JnM17  'E -,?PhRœ=8XcQs8IͷXMj?2l5L07?oGGeǼ&a[ASy@H`ᶋ( PߋH|l!@j◼<x}B#DkZ -@.7|_Zpt2qcXi<iM>yFl?ZϽ=*M-d4dV(&xeQL\"yVSK}W A)iʇ&GX-9.=G<9RHa # b!dj-zO]c`H CKŠiʺg9LByND;08Z~J!8v-}s̞J?cys2o) 7B:'F-uIUKg û ~kpƶTz%>Dv}7F']}=ChPI'j[R+KX΢O&hU棸vg矟C:\xampp). Within this file, 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.