|
|
|
ช่วยด้วยค่ะ การส่งเมลล์ STMP ส่งเมลล์ได้ แต่ไม่มีข้อความอะไรเลยค่ะ |
|
|
|
|
|
|
|
form กรอกข้อมูล Index.html
Code (PHP)
<!DOCTYPE HTML>
<!--
Astral 1.0 by HTML5 Up!
html5up.net | @n33co
Free for personal and commercial use under the CCA 3.0 license (html5up.net/license)
-->
<html>
<head>
<title> TESTT</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400" rel="stylesheet" />
<script src="js/jquery-1.9.1.min.js"></script>
<script src="css/5grid/init.js?use=mobile,desktop"></script>
<script src="js/jquery.formerize-1.1.js"></script>
<script src="js/init.js"></script>
<noscript>
<link rel="stylesheet" href="css/5grid/core.css" />
<link rel="stylesheet" href="css/5grid/core-desktop.css" />
<link rel="stylesheet" href="css/5grid/core-1200px.css" />
<link rel="stylesheet" href="css/5grid/core-noscript.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/style-desktop.css" />
<link rel="stylesheet" href="css/noscript.css" />
</noscript>
<!--[if lte IE 8]><link rel="stylesheet" href="css/ie8.css" /><![endif]-->
</head>
<body class="homepage">
<!-- Wrapper-->
<div id="wrapper">
<!-- Nav -->
<nav id="nav">
<a href="#email" class="icon icon-mail"><span>Email</span></a>
</nav>
<!-- Main -->
<div id="main">
<!-- Email -->
<article id="email" class="panel">
<header>
<h2>Email Me</h2>
</header>
<form method="post" action="test01.php" enctype="text/plain" >
<div class="5grid">
<div class="row">
<div class="6u">
<input type="text" class="text" name="namefrom" placeholder="Name" />
</div>
<div class="6u">
<input type="email" class="text" name="from" placeholder="Email" />
</div>
</div>
<div class="row">
<div class="12u">
<input type="text" class="text" name="subject" placeholder="Phone Number" />
</div>
</div>
<div class="row">
<div class="12u">
<textarea name="message" placeholder="Message"></textarea>
</div>
</div>
<div class="row">
<div class="12u">
<input type="submit" class="button" value="Send Message" />
<input type="reset" class="button" value="Clear Message" />
</div>
</div>
</div>
</form>
</article>
</div>
<!-- Footer -->
<div id="footer">
<ul class="links">
<li>© Jane Doe</li>
<li>Images : <a href="http://fotogrph.com/">fotogrph</a></li>
<li>Design : <a href="http://html5up.net/">HTML5 Up!</a></li>
</ul>
</div>
</div>
</body>
</html>
form action ค่ะ
เอา Code นี้ มาจากทางเว็บนี้ค่ะ แต่ว่า ลองทำดูแล้ว ค่าในตัวแปรก็ไม่โชว์ใน outlook
test01.php
Code (PHP)
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
</head>
<body>
<?php
function authMail($from, $namefrom, $to, $nameto, $subject, $message)
{
/*?your configuration here?*/
$smtpServer = "mail.xxx.co.th";
$port = "25";
$timeout = "30";
$username = "";
$password = "";
$localhost = "localhost";
$newLine = "\r\n";
$secure = 1;
/*?you shouldn't need to mod anything else */
//connect to the host and port
$smtpConnect = fsockopen($smtpServer, $port, $errno, $errstr, $timeout);
$smtpResponse = fgets($smtpConnect, 4096);
if(empty($smtpConnect))
{
$output = "Failed to connect: $smtpResponse";
return $output;
}
else
{
$logArray['connection'] = "Connected to: $smtpResponse";
}
//say HELO to our little friend
fputs($smtpConnect, "HELO $localhost". $newLine);
$smtpResponse = fgets($smtpConnect, 4096);
$logArray['heloresponse'] = "$smtpResponse";
//start a tls session if needed
if($secure)
{
fputs($smtpConnect, "STARTTLS". $newLine);
$smtpResponse = fgets($smtpConnect, 4096);
$logArray['tlsresponse'] = "$smtpResponse";
//you have to say HELO again after TLS is started
fputs($smtpConnect, "HELO $localhost". $newLine);
$smtpResponse = fgets($smtpConnect, 4096);
$logArray['heloresponse2'] = "$smtpResponse";
}
//request for auth login
fputs($smtpConnect,"AUTH LOGIN" . $newLine);
$smtpResponse = fgets($smtpConnect, 4096);
$logArray['authrequest'] = "$smtpResponse";
//send the username
fputs($smtpConnect, base64_encode($username) . $newLine);
$smtpResponse = fgets($smtpConnect, 4096);
$logArray['authusername'] = "$smtpResponse";
//send the password
fputs($smtpConnect, base64_encode($password) . $newLine);
$smtpResponse = fgets($smtpConnect, 4096);
$logArray['authpassword'] = "$smtpResponse";
//email from
fputs($smtpConnect, "MAIL FROM: $from" . $newLine);
$smtpResponse = fgets($smtpConnect, 4096);
$logArray['mailfromresponse'] = "$smtpResponse";
//email to
fputs($smtpConnect, "RCPT TO: $to" . $newLine);
$smtpResponse = fgets($smtpConnect, 4096);
$logArray['mailtoresponse'] = "$smtpResponse";
//the email
fputs($smtpConnect, "DATA" . $newLine);
$smtpResponse = fgets($smtpConnect, 4096);
$logArray['data1response'] = "$smtpResponse";
//construct headers
$headers = "MIME-Version: 1.0" . $newLine;
//$headers .= "Content-type: text/html; charset=iso-8859-1" . $newLine;
$headers .= "To: $nameto <$to>" . $newLine;
$headers .= "From: $namefrom <$from>" . $newLine;
//observe the . after the newline, it signals the end of message
fputs($smtpConnect, "To: $to\r\nFrom: $from\r\nSubject: $subject\r\n$headers\r\n\r\n$message\r\n.\r\n");
$smtpResponse = fgets($smtpConnect, 4096);
$logArray['data2response'] = "$smtpResponse";
// say goodbye
fputs($smtpConnect,"QUIT" . $newLine);
$smtpResponse = fgets($smtpConnect, 4096);
$logArray['quitresponse'] = "$smtpResponse";
$logArray['quitcode'] = substr($smtpResponse,0,3);
fclose($smtpConnect);
//a return value of 221 in $retVal["quitcode"] is a success
return($logArray);
}
$from = $_POST['from'] ;
$namefrom = $_POST['namefrom'] ;
$to = "[email protected]";
$nameto = "Mr.Support";
$subject = $_POST['subject'] ;
$message = $_POST['message'] ;
authMail($from, $namefrom, $to, $nameto, $subject, $message);
?>
</body>
</html>
ต้องแก้ยังไง ตรงไหนบ้างคะ ขอบคุณค่ะ
Tag : PHP, HTML/CSS, Action Script, Outlook Tools, Windows, Web Service
|
ประวัติการแก้ไข 2013-03-21 11:01:49 2013-03-21 11:01:59
|
|
|
|
|
Date :
2013-03-21 10:59:59 |
By :
fernbua |
View :
934 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
จากตัวอย่างนี้
PHP Sending Email Using Gmail SMTP Account Authentication
ผมเคยเขียนไว้ครับ
Code (PHP)
<?php
require_once('class.phpmailer.php');
$mail = new PHPMailer();
$mail->IsHTML(true);
$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = ""; // sets the prefix to the servier
$mail->Host = "mail.thaicreate.com"; // sets GMAIL as the SMTP server
$mail->Port = 25; // set the SMTP port for the GMAIL server
$mail->Username = "[email protected]"; // GMAIL username
$mail->Password = "xxxxxxx"; // GMAIL password
$mail->From = "[email protected]"; // "[email protected]";
//$mail->AddReplyTo = "[email protected]"; // Reply
$mail->FromName = "Mr.Weerachai Nukitram"; // set from Name
$mail->Subject = "Test sending mail.";
$mail->Body = "My Body & <b>My Description</b>";
$mail->AddAddress("[email protected]", "Mr.Adisorn Boonsong"); // to Address
$mail->Send();
?>
|
|
|
|
|
Date :
2013-03-21 11:01:08 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณค่ะ ลองแล้วนะคะ แต่มันยังติดค้างอยู่ใน C:\Inetpub\mailroot\Queue ค่ะ
ไม่ยอมเข้า Outlook เลยค่ะ หนักใจมากเลยค่ะ ลูกคนแรกก็ดื้อมากเลยค่ะ
ค้างอยู่ใน C:\Inetpub\mailroot\Queue ต้องแก้ยังไงคะ เพื่อจะให้ mail ไปถึง outlook ช่วยด้วยนะคะ
|
ประวัติการแก้ไข 2013-03-22 10:52:51 2013-03-22 10:53:06 2013-03-22 10:53:17
|
|
|
|
Date :
2013-03-22 10:25:36 |
By :
Mr.Ke |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|