

8
●230


<?php
require 'vendor/autoload.php';
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'vendor/phpmailer/phpmailer/src/PHPMailer.php';
require 'vendor/phpmailer/phpmailer/src/Exception.php';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST['name'] ?? '';
$email = $_POST['email'] ?? '';
$phone = $_POST['phone'] ?? '';
$message = $_POST['message'] ?? '';
$mail = new PHPMailer(true);
try {
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'asker244897@gmail.com';
$mail->Password = 'wovivtrwmfzedsef';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom($email, $name);
$mail->addAddress('asker244897@gmail.com');
$mail->isHTML(false);
$mail->Subject = 'Yeni iletişim mesajı';
$mail->Body = "Ad & Soyad: $name\nE-posta: $email\nTelefon Numarası: $phone\nMesaj: $message";
if ($mail->send()) {
echo 'E-posta başarıyla gönderildi.';
} else {
echo 'E-posta gönderilirken bir hata oluştu: ' . $mail->ErrorInfo;
}
} catch (Exception $e) {
echo 'E-posta gönderilirken bir hata oluştu: ' . $e->getMessage();
}
}
?> <!--<<< section contact design >>>--> <section class="contact" id="contact"> <h2 class="heading">Contact <span>Me!</span></h2> <form id="myForm" action="result.php" method="post"> <div class="input-box"> <input type="text" name="name" placeholder="Name & Surname"> <input type="email" name="email" placeholder="Email Address"> <input type="tel" name="phone" placeholder="Phone Number"> </div> <textarea name="message" id="message" cols="30" rows="10" placeholder="Your Message"></textarea> <input type="submit" name="send" value="Send Message" class="btn"> </form> </section>

<?php
$php_version = phpversion();
require 'vendor/autoload.php';
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'vendor/phpmailer/phpmailer/src/PHPMailer.php';
require 'vendor/phpmailer/phpmailer/src/Exception.php';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST['name'] ? $_POST['name'] : '' ;
$email = $_POST['email'] ? $_POST['email'] : '';
$phone = $_POST['phone'] ? $_POST['phone'] : '';
$message = $_POST['message'] ? $_POST['message'] : '';
$mail = new PHPMailer(true);
try {
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'asker244897@gmail.com';
$mail->Password = 'wovivtrwmfzedsef';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom($email, $name);
$mail->addAddress('asker244897@gmail.com');
$mail->isHTML(false);
$mail->Subject = 'Yeni iletişim mesajı';
$mail->Body = "Ad & Soyad: $name\nE-posta: $email\nTelefon Numarası: $phone\nMesaj: $message";
if ($mail->send()) {
echo $php_version . "<br>";
echo 'E-posta başarıyla gönderildi.';
} else {
echo 'E-posta gönderilirken bir hata oluştu: ' . $mail->ErrorInfo;
}
} catch (Exception $e) {
echo 'E-posta gönderilirken bir hata oluştu: ' . $e->getMessage();
}
}
?> <?php
$php_version = phpversion();
ini_set('display_errors', 1);
error_reporting(E_ALL);
require 'vendor/autoload.php';
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
if ($_SERVER["REQUEST_METHOD"] === "POST") {
$name = isset($_POST['name']) ? $_POST['name'] : '';
$email = isset($_POST['email']) ? $_POST['email'] : '';
$phone = isset($_POST['phone']) ? $_POST['phone'] : '';
$message = isset($_POST['message']) ? $_POST['message'] : '';
$mail = new PHPMailer(true);
try {
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'asker244897@gmail.com';
$mail->Password = 'wovivtrwmfzedsef';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom($email, $name);
$mail->addAddress('asker244897@gmail.com');
$mail->isHTML(false);
$mail->Subject = 'Yeni iletişim mesajı';
$mail->Body = "Ad & Soyad: $name\nE-posta: $email\nTelefon Numarası: $phone\nMesaj: $message";
if ($mail->send()) {
echo 'PHP Versiyon : ' . $php_version . "<br>";
echo 'E-posta başarıyla gönderildi.';
} else {
echo 'E-posta gönderilirken bir hata oluştu: ' . $mail->ErrorInfo;
}
} catch (Exception $e) {
echo 'E-posta gönderilirken bir hata oluştu: ' . $e->getMessage();
}
}
?>son şekli bu.

