walter wick
Kilopat
Daha fazla
- Cinsiyet
- Erkek
Sitemde email sunucusu yok ve PHPMailer kullanmaya karar verdim ama bir türlü mail gönderemiyorum.
Bir sürü kaynak video izledim ama çözemedim, bu arada outlook ile kullanamak istiyorum.
Dosya yapısı böyle;
kodlar;
Bir sürü kaynak video izledim ama çözemedim, bu arada outlook ile kullanamak istiyorum.
Dosya yapısı böyle;
kodlar;
PHP:
<?php
require 'mail/PHPMailer/src/Exception.php';
require 'mail/PHPMailer/src/PHPMailer.php';
require 'mail/PHPMailer/src/SMTP.php';
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
// E-posta gönderme işlemleri
$mail = new PHPMailer(true); // Exceptionları yakalamak için try-catch bloğu içinde kullanılacaksa true parametresi ile oluşturulmalı
try {
// SMTP ayarları
$mail->isSMTP();
$mail->Host = 'smtp-mail.outlook.com'; // Outlook SMTP sunucu adresi
$mail->SMTPAuth = true;
$mail->Username = 'walter@outlook.com'; // Outlook e-posta adresi
$mail->Password = 'pass'; // Outlook e-posta şifresi
$mail->SMTPSecure = 'tls'; // TLS kullanılmalı
$mail->Port = 587; // SMTP portu
// E-posta ayarları
$mail->setFrom('walterwick1@outlook.com', 'Yourd Name'); // Gönderen e-posta adresi ve ismi
$mail->addAddress('alııc', 'Recipient Name'); // Alıcı e-posta adresi ve ismi
$mail->Subject = 'Subject of the Email'; // E-posta konusu
$mail->Body = 'This is the body of the email'; // E-posta içeriği
$mail->send();
echo 'Email sent successfully';
} catch (Exception $e) {
echo 'Email could not be sent. Error: ', $mail->ErrorInfo;
}
?>
Son düzenleyen: Moderatör: