PDA

View Full Version : سوال: مشکل این کد ساده چیه ؟



AghaMohsen
دوشنبه 21 مرداد 1392, 13:48 عصر
مشکل این کد ساده چیه ؟ برای ارسال ایمیل :

<?php
if(!$_POST['sendMessage'])
{
header("location:Contact.html");
}
$to = "aghamohsen77@mohsen-app.ir";
$subject = $_POST[sendername];
$from = $_POST[sendermail];
$message = $_POST[message];
$headers = "From:".$from;

if mail( $to, $subject, $message, $headers)
{
echo "success";
}
else
{
echo "not success";
}
?>

MSN_Issue
دوشنبه 21 مرداد 1392, 17:42 عصر
چه اروری میده ؟

colors
دوشنبه 21 مرداد 1392, 17:51 عصر
بفرما

if(isset($_POST['sendMessage']) && !empty($_POST['sendMessage'])){
header("location:Contact.html");
exit;
}
$to = "aghamohsen77@mohsen-app.ir";
$subject = $_POST[sendername];
$from = $_POST[sendermail];
$message = $_POST[message];
$headers = "From:".$from;
$send = mail( $to, $subject, $message, $headers);

if ($send){
echo "success";
}
else{
echo "not success";
}