|
|
|
phpmailer มีใครเชี่ยวชาญช่วยแนะนำหน่อยคับ ว่าแนบไฟล์ส่งเมลยังงัย |
|
|
|
|
|
|
|
Code (PHP)
### INCLUDE PHPMAILER เข้ามา ###
include ("class.phpmailer.php");
require("class.smtp.php");
### FUNCTION SEND MAIL ####
function scriptdd_sendmail($to_name,$to_email,$from_name,$email_user_send,$email_pass_send,$subject,$body_html,$body_text) {
$mail = new PHPMailer();
$mail -> From = $email_user_send;
$mail -> FromName = $from_name;
$mail -> AddAddress($to_email,$to_name);
$mail -> Subject= $subject;
$mail -> Body= $body_html;
$mail -> CharSet = "utf-8";
$mail -> AltBody= $body_text;
$mail -> IsHTML (true);
$mail->IsSMTP();
$mail->Host = 'ssl://smtp.gmail.com';
$mail->Port = 465;
$mail->SMTPAuth= true;
//$mail->SMTPDebug= true;
$mail->Username = $email_user_send;
$mail->Password = $email_pass_send;
$mail->Send();
$mail->ClearAddresses();
}
### FUNCTION SEND MAIL ####
#### Function #####
$to_name = $_REQUEST['to'];
$to_email =$_REQUEST['to'];
$from_name ="System Notebook Qr-code Service..";
$email_user_send ="[email protected]";
$email_pass_send ="234123";
$subject = $_REQUEST['subject'];
$body_html =$_REQUEST['message'];
$body_text =$_REQUEST['message'];
if(scriptdd_sendmail($to_name,$to_email,$from_name,$email_user_send,$email_pass_send,$subject,$body_html,$body_text))
{
?>
<script language="javascript">
alert('ส่งอีเมล์ไม่ได้ .......');
window.location.href('show_news.php');
</script>
<?
}
else
{
?>
<script language="javascript">
alert('ส่งอีเมล์เรียบร้อย .......');
window.location.href('index.php');
</script>
<?
}
คือว่าผมเขียนโปรแกรมส่งเมลอะคับ พอดีว่าส่งเมลเป็นข้อความได้ แต่แนบไฟล์ส่งไปไม่ได้อะคับ แนะนำทีคับ
Tag : PHP
|
|
|
|
|
|
Date :
2011-02-02 02:05:59 |
By :
asinataru |
View :
1516 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
http://phpmailer.worxware.com/index.php?pg=methods
AddAttachment
|
|
|
|
|
Date :
2011-02-02 02:45:18 |
By :
mr.v |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|