ขอปรึกษาเรื่อง sendmail.php ทำยังไงให้เป็น HTML

เริ่มโดย donut, 20 พฤษภาคม 2009, 12:12:16

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

donut

คือที่ผ่านมาตลอด 2 ปีผมใข้โปรแกรมในการส่ง ebook ของผม

แต่เกิดปัญหาที่ว่า ผมต้องส่งจากเครื่อง notebook ของผมเท่านั้น

เวลาที่ผมอยู่เวร  ผมจึงไม่สามารถส่ง ebook ได้ทั้งที่ internet อยู่ตรงหน้าผมเนี่ย  :o

ทำให้เสียเวลา และลูกค้าคอยนาน  :P

===========================================

ดังนั้นผมจึงเขียนโปรแกรม php ขึ้นเพื่อใช้สำหรับส่ง ebook , username ,password ไปหาลูกค้าโดยดึง Username กับ Password จากฐานข้อมูล

เพื่อที่ผมจะได้ส่ง ebook ไปหาลูกค้าจากที่ไหนก็ได้ในโลกนี้ที่ต่อ internet  ;D

ปัญหามีข้อเดียวครับคือ  ทำอย่างไรให้มันส่งเป็น HTML  ติดอยู่ข้อเดียวเนี่ย  ???

/* ส่งเมล */
$subject="ส่ง ebook อ้วนศาสตร์";
$message="<html><title>ส่ง ebook อ้วนศาสตร์ </title>
<body><p>ระบบได้ทำการส่ง ebook แล้ว</p><br><br>
<p>เรียนคุณ  '$name'</p><br><br>

<p>ภายหลังจากที่คุณได้ download ebook อ้วนศาสตร์แล้ว ให้ใช้ username กับ password ต่อไปนี้เพื่อทำการ register</p><br><br>
<p>Username :</p> $username
<P>Password :</p> $password <br><br>

<p>ขอบคุณครับ</p>

</body></html>
";

$mailheaders="Return-path: [email protected]\n";
                                $mailheaders.="From: [email protected]\n";
                                $headers = 'MIME-Version: 1.0' . " ";
                                $headers .= 'Content-type: text/html; charset=UTF-8' . " ";                           
                                $mailheaders.="Content-Transfer-Encoding: 8bit\n";
                                $mailheaders.="Reply-To: [email protected]\n";
                                $mailheaders.="X-Return-Path: [email protected]\n";
if(mail($email,$subject,$message,$header))
        {print"ส่ง ebook เรียบร้อยแล้ว";}
else
         {print "ส่ง ebook ไม่ได้";}



ตัวแปร vairable แทนที่ได้หมดแล้ว  เหลือแค่ทำยังไงให้ส่งเป็น HTML  :P



มันเป็น code มาเลย  :-X
[direct=http://www.thaifittips.com]ลดน้ำหนัก ลดความอ้วน[/direct]

[direct=http://www.thaifittips.com/assoc]Affiliate Program Thaifittips.com คอมมิชชั่นสูง[/direct]

Tee++;

ต้องส่ง header ไปด้วย text/html

แต่ว่า ทำผ่าน class ดังๆ ดีกว่า

phpmailer
Swift Mailer
[direct=http://laravel.in.th]Laravel in Thai[/direct]
[direct=http://jquerytips.com]jQueryTips by Tee++;[/direct]
[direct=https://www.facebook.com/jQueryTips]jQueryTips Page[/direct]
[direct=https://www.facebook.com/Laravel.in.th]Laravel in Thai Page[/direct]
[direct=https://twitter.com/Teepluss]Teepluss's Twitter[/direct]