Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > ส่ง mail attach file แต่อ่านไฟล์ไม่ได้ คือเขียนโค้ดส่งเมล์แนบไฟล์มันส่งได้ ตอนส่งก็ทำการเข้ารหัสด้วย base64



 

ส่ง mail attach file แต่อ่านไฟล์ไม่ได้ คือเขียนโค้ดส่งเมล์แนบไฟล์มันส่งได้ ตอนส่งก็ทำการเข้ารหัสด้วย base64

 



Topic : 036131



โพสกระทู้ ( 768 )
บทความ ( 0 )



สถานะออฟไลน์




คือเขียนโค้ดส่งเมล์แนบไฟล์มันส่งได้ ตอนส่งก็ทำการเข้ารหัสด้วย base64 แต่ว่าไฟล์นั้นเปิดไม่ได้ เพราะมันถูกเข้ารหัส ผมลองเอาข้อความจากไฟล์มา base64_decode ในไฟล์ php นั้นมันสามารถอ่านได้ ผมจะทำอย่างไรให้อ่านได้ใน outlook



Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2009-12-23 12:00:55 By : naskw View : 4073 Reply : 9
 

 

No. 1



โพสกระทู้ ( 1,439 )
บทความ ( 0 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Facebook

https://www.thaicreate.com/php/php-send-email-attach-files.html






Date : 2009-12-23 12:51:24 By : xbeginner01
 


 

No. 2



โพสกระทู้ ( 768 )
บทความ ( 0 )



สถานะออฟไลน์


ผมก็ดูตัวอย่างจากตรงนั้นแหละมันส่งได้ครับ แต่ปัญหามันต่อจากนั้นครับเวลาเราเปิดดูไฟล์
Date : 2009-12-23 13:00:42 By : naskw
 

 

No. 3



โพสกระทู้ ( 10 )
บทความ ( 0 )



สถานะออฟไลน์


เจอปัญหานี้เหมือนกันคะ ส่ง ได้ แต่เปิดไฟล์ไม่ได้
Date : 2009-12-23 19:40:28 By : puiiz_zz
 


 

No. 4



โพสกระทู้ ( 768 )
บทความ ( 0 )



สถานะออฟไลน์


เงียบเลย เดี๋ยวลองดูอีกรอบถ้าได้เดี๋ยวมาโพสไว้
โพสเองตอบเอง ถือโอกาสปั้มกระทู้ซะเลย อิๆ
Date : 2009-12-23 22:28:10 By : naskw
 


 

No. 5



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ผมลองทดสอบแล้วก็ปกติดีน่ะครับ
Date : 2009-12-28 06:49:49 By : webmaster
 


 

No. 6

Guest


https://www.thaicreate.com/asp/iis-smtp-virtual-server.html ในตัวอย่างนี้ file ที่ส่งไปเป็น 0 byte อะคะ และ ลองเอาตัวเองมาลองทำ มี error ตรง header ด้วย และ file ที่แนบไปก็เป็น 0 byte ด้วย กรุณา ช่วยด้วยนะคะ ขอบคุณคะ
Date : 2010-03-31 10:21:56 By : ping
 


 

No. 7



โพสกระทู้ ( 7 )
บทความ ( 0 )



สถานะออฟไลน์


เป็นเหมือนกันเลยครับส่งไปเป็น 0byte วอนผู้รู้ช่วยหน่อยนะครับ
Date : 2010-07-09 10:11:48 By : krailerk
 


 

No. 8



โพสกระทู้ ( 768 )
บทความ ( 0 )



สถานะออฟไลน์


ลองเอานี่ไปลองนะครับแต่ตัวนี้ไม่ได้ Attach file นะครับแต่เป็นการใส่ภาพลงไปในอีเมล์เลย แบบว่าเวลาเปิดเมล์ภาพจะแสดงทันที เดี๋ยวผมลองทำตัว Att file ก่อน เดี๋ยวจะเอามาแป๊ะไว้
Code (PHP)
$to  = ""; // recipients
$subject = "Test for Embedded Image & Attachement"; 
$sep = sha1(date('r', time()));// Create a boundary string.  It needs to be unique 
// Add in our content boundary, and mime type specification:  
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/related; boundary=\"PHP-related-{$sep}\"; type=\"multipart/alternative\"\r\n";
// additional headers
$headers .= "To: You < email address > \r\n"; 
$headers .= "From: Me < email address >  \r\n"; 
$inline = chunk_split(base64_encode(file_get_contents('services.gif')));

$body =<<<EOBODY
--PHP-related-{$sep}
Content-Type: multipart/alternative; boundary="PHP-alt-{$sep}"
--PHP-alt-{$sep}
Content-Type: text/plain;charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
This text in text plain mode.
--PHP-alt-{$sep}
Content-Type: text/html;charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3DUTF-8" http-equiv=3DContent-Type>
<META name=3DGENERATOR content=3D"MSHTML 8.00.6001.18854">
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT size=2 face=3DArial color=3Dred>this text in text html mode</FONT></DIV><BR>
<IMG src=3D"cid:$sep">
</BODY>
</HTML>

--PHP-alt-{$sep}
--PHP-related-{$sep}
Content-Type: image/gif;name="services.gif"
Content-Transfer-Encoding: base64
Content-ID: <$sep>
{$inline}
--PHP-related-{$sep}
EOBODY;

// Finally, send the email
mail($to, $subject, $body, $headers);

Date : 2010-07-09 16:22:16 By : naskw
 


 

No. 9



โพสกระทู้ ( 768 )
บทความ ( 0 )



สถานะออฟไลน์


อันนี้เป็น attach file นะครับลองแกะโค้ดเอาเองนะไม่อธิบาย ขี้เกียจ
อันนี้สามารถใช้กับ outlook express ได้นะครับ รวมทั้งตัวอื่นๆด้วย
Code (PHP)
<?php
$to  = "email-address"; // recipients
$subject = "Test for Embedded Image & Attachement"; 
$sep = sha1(date('r', time()));// Create a boundary string.  It needs to be unique 
// Add in our content boundary, and mime type specification:  
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: multipart/related; boundary=\"PHP-related-{$sep}\"; type=\"multipart/alternative\"\r\n";
// additional headers
$headers .= "To: You <email-address>\r\n"; 
$headers .= "From: Me <email-address>\r\n"; 
$inline = chunk_split(base64_encode(file_get_contents('services.gif')));

$body =<<<EOBODY
--PHP-related-{$sep}
Content-Type: multipart/alternative; boundary="PHP-alt-{$sep}"
--PHP-alt-{$sep}
Content-Type: text/plain;charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
This text in text plain mode.
--PHP-alt-{$sep}
Content-Type: text/html;charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3DUTF-8" http-equiv=3DContent-Type>
<META name=3DGENERATOR content=3D"MSHTML 8.00.6001.18854">
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT size=2 face=3DArial color=3Dred>this text in text html mode</FONT></DIV><BR>

</BODY>
</HTML>

--PHP-alt-{$sep}
--PHP-related-{$sep}
Content-Type: image/gif;name="services.gif"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; // ตรงนี้เพิ่มขึ้นมาจากโค้ดข้างบน
Content-ID: <$sep>
{$inline}
--PHP-related-{$sep}
EOBODY;

// Finally, send the email
mail($to, $subject, $body, $headers);
?>

Date : 2010-07-09 16:31:04 By : naskw
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ส่ง mail attach file แต่อ่านไฟล์ไม่ได้ คือเขียนโค้ดส่งเมล์แนบไฟล์มันส่งได้ ตอนส่งก็ทำการเข้ารหัสด้วย base64
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่