|
 |
|
รบกวนพี่ๆทุกท่านที่รู้เรื่อง mail หน่อยครับคือผมมีคำถามอยากทราบเกียวกับการ set ค่านิดหน่อย |
|
 |
|
|
 |
 |
|
ผมมีคำถามเกี่ยวกับการส่งmailนิดหน่อยครับตามcodeน่ะครับ
Code (PHP)
<?php
//error_reporting(E_ALL);
error_reporting(E_STRICT);
date_default_timezone_set('America/Toronto');
require_once('PHPMailer/class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
$mail = new PHPMailer();
$body = file_get_contents('contents.html');
$body = eregi_replace("[\]",'',$body);
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->SMTPDebug = 2; // enables SMTP debug information (for testing)
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->Host = 'ssl://smtp.gmail.com:465'; // sets the SMTP server
//$mail->Port = 26; // set the SMTP port for the GMAIL server
$mail->Username = ""; // SMTP account username
$mail->Password =""; // SMTP account password <---------------มันมีปัญหาตรงนี้
$mail->SetFrom('', 'First Last');
$mail->AddReplyTo("","First Last");
$mail->Subject = "PHPMailer Test Subject via smtp, basic with authentication";
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$address = "";
$mail->AddAddress($address, "John Doe");
$mail->AddAttachment("PHPMailer/examples/images/phpmailer.gif"); // attachment
$mail->AddAttachment("PHPMailer/examples/images/phpmailer_mini.gif"); // attachment
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
ก่อนอืนผมขอแจ้งก่อนน่ะครับว่าการส่งmailข้างบนสามารถส่งได้ทดสอบดูแล้วว่าผ่านครับแต่ผมมีคำถามอยู่ว่า
$mail->Password =""; // SMTP account password <---------------มันมีปัญหาตรงนี้
คือcodeที่ผมได้มาต้องใส่ password ในการส่งmail ของเรา ผมอยากทราบมีวิธีการซ่อนpassword ตรงนี้ได้ไหมครับ
คือผมว่าในกรณีที่มีคนเอาformไปใช้เค้าอาจเห็น passwordเราได้เลยอยากทราบว่ามีวิธีการแก้ไขปัญหาตรงนี้อย่างไงครับ
ช่วยหน่อยน่ะครับผมนั่งศึกษาการส่งmailจนตาลายแล้วตอนนี้จะอวกมาเป็นcodeแล้วครับT.T
Tag : PHP, MySQL

|
|
 |
 |
 |
 |
Date :
2010-09-27 12:47:58 |
By :
ninjadark |
View :
1023 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
|
|

|
Load balance : Server 02
|