PHP ile Email Formunu Göndermek
Basit bir email formu gönderme uygulaması
<!DOCTYPE html>
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
.sol { width: 150px; float:left; }
.sag { width: 350px; float:left; }
.clear { clear:both }
</style>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('input, textarea, submit').bind("mouseover", function() {
$(this).css("background", "yellow");
$(this).bind("mouseout", function() {
$(this).css("background", "#ffffff");
})
})
});
</script>
</head>
<body>
<div>
<?php
?>
<form name="test" method="post">
<div>
<div class="clear">
<div class="sol">Adınızı Giriniz</div>
<div class="sag"><input type="text" name="isim" value="<?php echo $_POST['isim']?>" /></div>
</div>
<div class="clear">
<div class="sol">Soyadınızı Giriniz</div>
<div class="sag"><input type="text" name="soyisim" alue="<?php echo $_POST['soyisim']?>" /></div>
</div>
<div class="clear">
<div class="sol">Adresinizi Giriniz</div>
<div class="sag"><textarea name="adres" rows="2" cols="50"><?php echo $_POST['adres']?></textarea></div>
<div class="clear">
<div class="sol">İlinizi Seçin</div>
<div class="sag">
<select name="il">
<option>Adana</option><option>Ankara</option><option>Mersin</option>
</select>
</div>
</div>
<div class="clear">
<div class="sol">Konu</div>
<div class="sag"><input type="text" name="konu" /></div>
</div>
<div class="clear">
<div class="sol">Mesajınız</div>
<div class="sag"><textarea name="mesaj" rows="2" cols="50"></textarea></div>
</div>
<div class="clear">
<div class="sol"> </div>
<<div class="sag"><input type="submit" value="Gönder" /></div>
</div>
</form>
</div>
</body>
</html>
<html>
<head>
<title>TODO supply a title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
.sol { width: 150px; float:left; }
.sag { width: 350px; float:left; }
.clear { clear:both }
</style>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('input, textarea, submit').bind("mouseover", function() {
$(this).css("background", "yellow");
$(this).bind("mouseout", function() {
$(this).css("background", "#ffffff");
})
})
});
</script>
</head>
<body>
<div>
<?php
if (!empty($_POST)) {
$Mesaj = $_POST['il'] . $_POST['adres'] . $_POST['isim'] . $_POST['soyisim'] . " isimli kullanıcısından gelen mesaj: " . $_POST['mesaj'];
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "rn";
$headers .= 'Content-type: text/html; charset=iso-8859-9' . "rn";
// Additional headers
$headers .= 'To: Aykut Dagdelen <dagdelenr@yandex.com>' . "rn";
$headers .= 'From: Aykut Dagdelen <dagdelen@yandex.com>' . "rn";
//$headers .= 'Cc: birthdayarchive@example.com' . "rn";
//$headers .= 'Bcc: birthdaycheck@example.com' . "rn";
if (mail("dagdelen@yandex.com", $_POST['konu'], $Mesaj, $headers)) {
echo "Mailiniz gönderilmiştir";
}
}
$Mesaj = $_POST['il'] . $_POST['adres'] . $_POST['isim'] . $_POST['soyisim'] . " isimli kullanıcısından gelen mesaj: " . $_POST['mesaj'];
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "rn";
$headers .= 'Content-type: text/html; charset=iso-8859-9' . "rn";
// Additional headers
$headers .= 'To: Aykut Dagdelen <dagdelenr@yandex.com>' . "rn";
$headers .= 'From: Aykut Dagdelen <dagdelen@yandex.com>' . "rn";
//$headers .= 'Cc: birthdayarchive@example.com' . "rn";
//$headers .= 'Bcc: birthdaycheck@example.com' . "rn";
if (mail("dagdelen@yandex.com", $_POST['konu'], $Mesaj, $headers)) {
echo "Mailiniz gönderilmiştir";
}
}
?>
<form name="test" method="post">
<div>
<div class="clear">
<div class="sol">Adınızı Giriniz</div>
<div class="sag"><input type="text" name="isim" value="<?php echo $_POST['isim']?>" /></div>
</div>
<div class="clear">
<div class="sol">Soyadınızı Giriniz</div>
<div class="sag"><input type="text" name="soyisim" alue="<?php echo $_POST['soyisim']?>" /></div>
</div>
<div class="clear">
<div class="sol">Adresinizi Giriniz</div>
<div class="sag"><textarea name="adres" rows="2" cols="50"><?php echo $_POST['adres']?></textarea></div>
<div class="clear">
<div class="sol">İlinizi Seçin</div>
<div class="sag">
<select name="il">
<option>Adana</option><option>Ankara</option><option>Mersin</option>
</select>
</div>
</div>
<div class="clear">
<div class="sol">Konu</div>
<div class="sag"><input type="text" name="konu" /></div>
</div>
<div class="clear">
<div class="sol">Mesajınız</div>
<div class="sag"><textarea name="mesaj" rows="2" cols="50"></textarea></div>
</div>
<div class="clear">
<div class="sol"> </div>
<<div class="sag"><input type="submit" value="Gönder" /></div>
</div>
</form>
</div>
</body>
</html>
Yorumunuzu Ekleyin