Archive for code php

send email php ผ่าน gmail

<html>
<head>
<title>Question</title>
</head>
<body>
<?php
	require_once('class.phpmailer.php');
	$mail = new PHPMailer();
	$mail->CharSet = "utf-8";
	$mail->IsHTML(true);
	$mail->IsSMTP();
	$mail->SMTPAuth = true; // enable SMTP authentication
	$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
	$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
	$mail->Port = 465; // set the SMTP port for the GMAIL server
	$mail->Username = "kapoii.za@gmail.com"; // GMAIL username
	$mail->Password = "036543269"; // GMAIL password
	$mail->From = "webmaster@glandlyshop.com"; // "name@yourdomain.com";
	//$mail->AddReplyTo = "support@thaicreate.com"; // Reply
	$mail->FromName = "web master glandly shop";  // set from Name
	$mail->Subject = "New Question";
	$mail->Body = "<b>You have new Question</b>"."<br>". "ชื่อผู้ถาม : ".$_POST["nameask"]."<br>"  ."หัวข้อ : ".$_POST["topicask"] ."<br>" . "รายละเอียด : ".$_POST["detailask"]  ."<br>". "email : " . $_POST["emailask"];
	$mail->AddAddress("cooi.pz@hotmail.com", "Poiinismz"); // to Address
	/*$mail->AddAttachment("thaicreate/myfile.zip");
	$mail->AddAttachment("thaicreate/myfile2.zip");*/

	//$mail->AddCC("member@thaicreate.com", "Mr.Member ShotDev"); //CC
	//$mail->AddBCC("member@thaicreate.com", "Mr.Member ShotDev"); //CC

	$mail->set('X-Priority', '1'); //Priority 1 = High, 3 = Normal, 5 = low

	$mail->Send();
	//echo $mail="send done";
	echo "<script language=\"JavaScript\">";
	echo "alert('Send Done!!');";
	echo "</script>";
?>
</body>
</html>

Free Web Hosting