www.logomerkezi.com/mail.rar
mail sınıfını indirin aşağıdaki kodları kendinie göre ayarlayın.
<!-- SEWAT ALERT CDN -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/2.1.2/sweetalert.min.js" integrity="sha512-AA1Bzp5Q0K1KanKKmvN/4d3IRKVlv9PYgwFPvm32nPO6QS8yH1HO7LbgB1pgiOxPtfeg5zEn2ba64MUcqJx6CA==" crossorigin="anonymous"></script>
<?php
$db = new PDO("mysql:host=localhost;dbname=DATABASE;charset=utf8", "KULLANICI","ŞİFRE");
if(isset($_POST['mesajat'])){
$kaydet=$db->prepare("INSERT INTO mesaj SET
adsoyad=:adsoyad,
eposta=:eposta,
mesajkonu=:mesajkonu,
mesajicerik=:mesajicerik
");
$insert=$kaydet->execute(array(
'adsoyad' => $_POST['adsoyad'],
'eposta' => $_POST['eposta'],
'mesajkonu' => $_POST['mesajkonu'],
'mesajicerik' => $_POST['mesajicerik'],
));
if($insert){
include("mail/PHPMailerAutoload.php");
$mail = new PHPMailer;
$mail->IsSMTP();
//$mail->SMTPDebug = 1; // hata ayiklama: 1 = hata ve mesaj, 2 = sadece mesaj
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'ssl'; // Güvenli baglanti icin ssl normal baglanti icin tls
$mail->Host = "smtp.yandex.com"; // Mail sunucusuna ismi
$mail->Port = 465; // Gucenli baglanti icin 465 Normal baglanti icin 587
$mail->IsHTML(true);
$mail->SetLanguage("tr", "PHPMailer/language");
$mail->CharSet ="utf-8";
$mail->Username = "info@siteadresi.com"; // Mail adresimizin kullanicı adi
$mail->Password = "ŞİFRENİZ"; // Mail adresimizin sifresi
$mail->SetFrom("info@siteadresi.com","YENİ MESAJ VAR!"); // Mail attigimizda gorulecek ismimiz
$mail->AddAddress("info@siteadresi.com"); // Maili gonderecegimiz kisi yani alici
$mail->addReplyTo("info@siteadresi.com", "YENİ MESAJ VAR!"); // Mail Cevaplama görülecek isim
$mail->Subject = "YENİ MESAJ VAR!"; // Konu basligi
$mail->Body = "
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<title>MESAJ VAR!</title>
<style type='text/css'>
body {margin: 0; padding: 0; min-width: 100%!important;}
.content {width: 100%; max-width: 600px;}
</style>
</head>
<body yahoo bgcolor='#f6f8f1'>
<table width='100%' bgcolor='#f6f8f1' border='0' cellpadding='0' cellspacing='0'>
<tr>
<td>
<table class='content' align='center' cellpadding='0' cellspacing='0' border='0'>
<tr>
<td>
<b>Adı Soyadı :</b> ".$_POST['adsoyad']." <br>
<b>E-Posta Adresi :</b> <a href='mailito://".$_POST['eposta']."'></a>".$_POST['eposta']." <br>
<b>Konu :</b> ".$_POST['mesajkonu']." <br>
<b>Mesaj :</b> ".$_POST['mesajicerik']."
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
"; // Mailin icerigi
if(!$mail->Send()){
echo '<div style="margin-top:20px;" class="alert alert-warning">
KAYIT ALINDI FAKAT MAİL GÖNDERİLMEDİ
<script type="text/javascript"> swal("MESAJ GÖNDERİLDİ!", "En Kısa Sürede İletişime Geçecektir.", "info");</script></div>';
}else {
echo '<div style="margin-top:20px;" class="alert alert-success">
KAYIT ALINDI. EN KISA SÜREDE İLETİŞİME GEÇİLECEKTİR.
<script type="text/javascript"> swal("MESAJ GÖNDERİLDİ!", "En Kısa Sürede İletişime Geçecektir.", "success");</script></div>';
}
}else {
echo '<div style="margin-top:20px;" class="alert alert-warning"><script type="text/javascript"> swal("HATA!", "Mesaj gönderilirken bir hata oluştu.", "error");</script></div>';
}
}else { ?>
<form action="" class="register-form" method="POST">
<div class="form-group">
<label>Ad Soyad <span class="required">*</span></label>
<input type="text" name="adsoyad" placeholder="Lütfen Adınızı ve Soyadınızı Giriniz..." required>
</div>
<div class="form-group">
<label>Eposta Adresi <span class="required">*</span></label>
<input type="email" name="eposta" placeholder="Lütfen Mail Adresinizi Giriniz..." required>
</div>
<div class="form-group">
<label>Konu <span class="required">*</span></label>
<input type="text" name="mesajkonu" placeholder="Lütfen Konu Başlığını Giriniz..." required>
</div>
<div class="form-group">
<label>Mesajınız <span class="required">*</span></label>
<textarea name="mesajicerik" placeholder="Lütfen Mesajınızı Giriniz..."></textarea>
</div>
<!--<div class="form-group">
<div class="g-recaptcha" data-sitekey="6LeupI0UAAAAAAyBpYDZfH3dc9oBSC7ulxWUqXyS"></div>
</div>-->
<div class="form-group">
<button type="submit" name="mesajat" class="contact-form-btn" >MESAJ GÖNDER</button>
</div>
</form>
<?php
}
?>