If you’re a PHP application developer, you might need to send email notifications through your custom PHP applications. With XAMPP, there are two ways to do this: you can use the included sendmail.exe binary, or you can use the third-party PHPMailer class. This guide walks you through both options. Show
To configure XAMPP to use sendmail.exe for email notifications, follow these steps:
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 = ''; $subject = 'Hello from XAMPP!'; $message = 'This is a test'; $headers = "From: \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. To configure XAMPP to use PHPMailer for email notifications, follow these steps:
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 = ''; $mail->Password = 'your-gmail-password'; $mail->setFrom(''); $mail->addAddress(''); $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. Apakah aplikasi XAMPP gratis?Software XAMPP dikembangkan oleh tim bernama Apache Friends pada tahun 2002, yang bisa didapatkan secara gratis dengan label GNU (General Public License).
Aplikasi XAMPP untuk apa?Fungsinya adalah sebagai server yang berdiri sendiri (localhost), yang terdiri atas program Apache HTTP Server, MySQL database, dan penerjemah bahasa yang ditulis dengan bahasa pemrograman PHP dan Perl.
Jelaskan langkah langkah instalasi XAMPP?Cara install XAMPP di Windows. Download aplikasi XAMPP terbaru , klik disini.. Dobel klik file XAMPP yang baru saja Anda download, selanjutnya akan muncul jendela “installer language” seperti gambar di bawah ini:. Lanjutkan dengan memilih bahasa. ... . Terkadang pada proses ini muncul pesan error.. Apa yang dimaksud dengan Laragon?Laragon adalah lingkungan pengembangan universal yang portabel, terisolasi, cepat & kuat untuk PHP, Node.js, Python, Java, Go, Ruby. Ini cepat, ringan, mudah digunakan dan mudah diperpanjang. Laragon sangat bagus untuk membangun dan mengelola aplikasi web modern.
|