|
|
|
ช่วยดู code ส่งเมลให้ทีคับ รันผ่าน ส่งเรียบร้อยแต่ไม่เข้าเมลเลยคับ.... |
|
|
|
|
|
|
|
ผมทำ php ส่งเมล มันบอกว่าส่งสำเร็จแต่ไม่เห้นไปเลยคับ ช่วยทีคับ
<?
session_start();
mysql_connect("localhost","root","123456");
mysql_select_db("mydatabase");
if(trim($_POST["txtUsername"]) == "")
{
echo "Please input Username!";
exit();
}
if(trim($_POST["txtPassword"]) == "")
{
echo "Please input Password!";
exit();
}
if($_POST["txtPassword"] != $_POST["txtConPassword"])
{
echo "Password not Match!";
exit();
}
if(trim($_POST["txtName"]) == "")
{
echo "Please input Name!";
exit();
}
if(trim($_POST["txtEmail"]) == "")
{
echo "Please input Email!";
exit();
}
$strSQL = "SELECT * FROM member WHERE Username = '".trim($_POST['txtUsername'])."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if($objResult)
{
echo "Username already exists!";
}
else
{
$strSQL = "INSERT INTO member (Username,Password,Name,Email,Status,SID,Active) VALUES ('".$_POST["txtUsername"]."',
'".$_POST["txtPassword"]."','".$_POST["txtName"]."' ,'".$_POST["txtEmail"]."','USER','".session_id()."','No')";
$objQuery = mysql_query($strSQL);
$Uid = mysql_insert_id();
echo "Register Completed!<br>Please check your email to activate account";
$strTo = $_POST["txtEmail"];
$strSubject = "Activate Member Account";
$strHeader = "Content-type: text/html; charset=windows-874\n"; // or UTF-8 //
$strHeader .= "From: [email protected]\nReply-To: [email protected]";
$strMessage = "";
$strMessage .= "Welcome : ".$_POST["txtName"]."<br>";
$strMessage .= "=================================<br>";
$strMessage .= "Activate account click here.<br>";
$strMessage .= "https://www.thaicreate.com/activate.php?sid=".session_id()."&uid=".$Uid."<br>";
$strMessage .= "=================================<br>";
$strMessage .= "ThaiCreate.Com<br>";
$flgSend = mail($strTo,$strSubject,$strMessage,$strHeader);
}
mysql_close();
?>
Tag : PHP, MySQL, CakePHP
|
|
|
|
|
|
Date :
2012-07-12 09:41:07 |
By :
recka |
View :
1037 |
Reply :
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Register Completed!
Please check your email to activate account
แต่เมลไม่เข้า...
|
|
|
|
|
Date :
2012-07-12 09:42:51 |
By :
recka |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เงื่อนไขผิดมันก็เลยผิดน่ะครับ
อันที่ถูก ถ้าจะเช็คว่าเมส์ส่งออกหรือไม่ให้ใส่ เงื่อนไขไว้ตรงที่มันส่งเมล์เลย
Code (PHP)
<?
session_start();
mysql_connect("localhost","root","123456");
mysql_select_db("mydatabase");
if(trim($_POST["txtUsername"]) == "")
{
echo "Please input Username!";
exit();
}
if(trim($_POST["txtPassword"]) == "")
{
echo "Please input Password!";
exit();
}
if($_POST["txtPassword"] != $_POST["txtConPassword"])
{
echo "Password not Match!";
exit();
}
if(trim($_POST["txtName"]) == "")
{
echo "Please input Name!";
exit();
}
if(trim($_POST["txtEmail"]) == "")
{
echo "Please input Email!";
exit();
}
$strSQL = "SELECT * FROM member WHERE Username = '".trim($_POST['txtUsername'])."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if($objResult)
{
echo "Username already exists!";
}
else
{
$strSQL = "INSERT INTO member (Username,Password,Name,Email,Status,SID,Active) VALUES ('".$_POST["txtUsername"]."',
'".$_POST["txtPassword"]."','".$_POST["txtName"]."' ,'".$_POST["txtEmail"]."','USER','".session_id()."','No')";
$objQuery = mysql_query($strSQL);
$Uid = mysql_insert_id();
$strTo = $_POST["txtEmail"];
$strSubject = "Activate Member Account";
$strHeader = "Content-type: text/html; charset=windows-874\n"; // or UTF-8 //
$strHeader .= "From: [email protected]\nReply-To: [email protected]";
$strMessage = "";
$strMessage .= "Welcome : ".$_POST["txtName"]."<br>";
$strMessage .= "=================================<br>";
$strMessage .= "Activate account click here.<br>";
$strMessage .= "https://www.thaicreate.com/activate.php?sid=".session_id()."&uid=".$Uid."<br>";
$strMessage .= "=================================<br>";
$strMessage .= "ThaiCreate.Com<br>";
if (mail($strTo,$strSubject,$strMessage,$strHeader))
{
echo 'Register Completed!<br>Please check your email to activate account';
} else {
echo 'Can not send your email';
}
}
mysql_close();
?>
|
ประวัติการแก้ไข 2012-07-12 10:35:09
|
|
|
|
Date :
2012-07-12 10:34:42 |
By :
adaaugusta |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
รบกวนอีกทีคับ พอดีลองแล้ว ข้อมูลไม่เข้าใน db แล้วก้อส่งแต่ก้อไม่เข้าเมลเหมือนเดิมคับ ขอลบกวนอีกทีคับ
|
|
|
|
|
Date :
2012-07-12 11:14:24 |
By :
recka |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?
session_start();
mysql_connect("localhost","root","123456");
mysql_select_db("mydatabase");
if(trim($_POST["txtUsername"]) == "")
{
echo "Please input Username!";
exit();
}
if(trim($_POST["txtPassword"]) == "")
{
echo "Please input Password!";
exit();
}
if($_POST["txtPassword"] != $_POST["txtConPassword"])
{
echo "Password not Match!";
exit();
}
if(trim($_POST["txtName"]) == "")
{
echo "Please input Name!";
exit();
}
if(trim($_POST["txtEmail"]) == "")
{
echo "Please input Email!";
exit();
}
$strSQL = "SELECT * FROM member WHERE Username = '".trim($_POST['txtUsername'])."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if($objResult)
{
echo "Username already exists!";
}
else
{
$strSQL = "INSERT INTO member (Username,Password,Name,Email,Status,SID,Active) VALUES ('".$_POST["txtUsername"]."',
'".$_POST["txtPassword"]."','".$_POST["txtName"]."' ,'".$_POST["txtEmail"]."','USER','".session_id()."','No')";
$objQuery = mysql_query($strSQL);
$Uid = mysql_insert_id();
$strTo = $_POST["txtEmail"];
$strSubject = "Activate Member Account";
$strHeader = "Content-type: text/html; charset=windows-874\n"; // or UTF-8 //
$strHeader .= "From: [email protected]\nReply-To: [email protected]";
$strMessage = "";
$strMessage .= "Welcome : ".$_POST["txtName"]."<br>";
$strMessage .= "=================================<br>";
$strMessage .= "Activate account click here.<br>";
$strMessage .= "https://www.thaicreate.com/activate.php?sid=".session_id()."&uid=".$Uid."<br>";
$strMessage .= "=================================<br>";
$strMessage .= "ThaiCreate.Com<br>";
if (mail($strTo,$strSubject,$strMessage,$strHeader))
{
echo 'Register Completed!<br>Please check your email to activate account';
} else {
echo 'Can not send your email';
}
}
mysql_close();
?>
ยังไม่เข้าเมล เลยคับ ขอบคุงมากคับๆๆๆ ช่วยอีกทีคับๆๆๆ
|
|
|
|
|
Date :
2012-07-12 11:27:11 |
By :
recka |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Register Completed!
Please check your email to activate account
|
|
|
|
|
Date :
2012-07-12 11:27:54 |
By :
recka |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|