<?php if (isset($_POST['email'])) $isim = $_POST['isim'] ; $email = $_POST['email'] ; $mesaj = $_POST['mesaj'] ; $baslik = "HTML Turkten Mesaj var."; $kime = "info@htmlturk.com "; $mailbilgileri = "From:$email"; mail($kime, $baslik, $mesaj, $mailbilgileri); { echo "Email formumuzu doldurduğunuz için teşekkürler."; } ?> Code (markup): I am trying to make a simple php mail script.it is working when put in another hosts. But it is not working in my host. Host firm recommend to use smtp. What I should about it?Please me!
use this code <?php ini_set("SMTP","mail.yoursite.com"); //mail.yoursite.com should be your local smtp ini_set("smtp_port","25"); //25 should be your smtp port ini_set("sendmail_from","info@yoursite.com"); //info@yoursite.com should be your site email //all your php email code goes below ?> Code (markup):
Here is my codes: <html> <body> <head> <meta http-equiv="content-language" content="tr"> <META http-equiv="Content-Type" content="text/html; charset=UTF-8"> </head> <?php if (isset($_POST['email'])) { $isim = $_POST['isim'] ; $email = $_POST['email'] ; $mesaj = $_POST['mesaj'] ; $baslik = 'HTML Turkten Mesaj var.'; $kime = 'info@htmlturk.com '; $mailbilgileri = 'From:$email'; mail($kime, $baslik, $mesaj, $mailbilgileri); if(empty($isim) || empty($email) || empty($mesaj) ) { echo "<h2>Lütfen boş bıraktığınız alanları doldurunuz.</h2><h2><a href='index.php?id=50'>Mail Sayfasına Geri Dön</a></h2>"; } elseif (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$", $email)) { echo "<h2>Geçersiz <b>E-Mail Adresi</b> yazdiniz!</h2><h2><a href='index.php?id=50'>Mail Sayfasına Geri Dön</a></h2>"; } else { echo "Email formumuzu doldurduğunuz için teşekkürler."; } } ?> </body> </html> The in codes above, how can make smtp?
add these 3 line of code (make sure you edit mail.yoursite.com to your local smtp, 25 to your smtp port, to your email on your domain) ini_set("SMTP","mail.yoursite.com"); //mail.yoursite.com should be your local smtp ini_set("smtp_port","25"); //25 should be your smtp port ini_set("sendmail_from","info@yoursite.com"); //info@yoursite.com should be your site email above mail($kime, $baslik, $mesaj, $mailbilgileri);
<?php if (isset($_POST['email'])) { ini_set("SMTP","mail.htmlturk.com"); ini_set("smtp_port",25); ini_set("$email","info@htmlturk.com"); $isim = $_POST['isim'] ; $email = $_POST['email'] ; $mesaj = $_POST['mesaj'] ; $baslik = 'HTML Turkten Mesaj var.'; mail( $baslik, $mesaj,$isim, $mailbilgileri); if(empty($isim) || empty($email) || empty($mesaj) ) { echo "<h2>Lütfen boş bıraktığınız alanları doldurunuz.</h2><h2><a href='index.php?id=50'>Mail Sayfasına Geri Dön</a></h2>"; } elseif (!eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3}$", $email)) { echo "<h2>Geçersiz <b>E-Mail Adresi</b> yazdiniz!</h2><h2><a href='index.php?id=50'>Mail Sayfasına Geri Dön</a></h2>"; } else { echo "Email formumuzu doldurduğunuz için teşekkürler."; } } ?> These codes still arent working.