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 > สอบถามครับ ผมใช้ Function ส่งเมล์ โดยสามารถแนบเอกสารเป็น File PDF ได้แล้วครับ แต่ผมอยากให้มันส่ง File PDF ให้ได้ 2 ฉบับต่อ 1 เมล์ ทำอย่างไรครับ



 

สอบถามครับ ผมใช้ Function ส่งเมล์ โดยสามารถแนบเอกสารเป็น File PDF ได้แล้วครับ แต่ผมอยากให้มันส่ง File PDF ให้ได้ 2 ฉบับต่อ 1 เมล์ ทำอย่างไรครับ

 



Topic : 130420



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



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




สอบถามครับ ผมใช้ Function ส่งเมล์ โดยสามารถแนบเอกสารเป็น File PDF ได้แล้วครับ แต่ผมอยากให้มันส่ง File PDF ให้ได้ 2 ฉบับต่อ 1 เมล์ ทำอย่างไรครับ



Code (PHP)
//@ Load the dompdf files
require_once("../sendmail/dompdf/dompdf_config.inc.php");
// Load the SwiftMailer files
require_once("../sendmail/swift/swift_required.php");

// @ Handle pdf for hotel email
// @ Get the contents of the pdf_sento_hotel into a variable for later
ob_start();
include("../sendmail/pdf_sento_hotel.php");
$pdf_html_hotel = ob_get_contents();
print_r($pdf_html_hotel);
ob_end_clean();

// Load the dompdf files
require_once("../sendmail/dompdf/dompdf_config.inc.php");

$dompdf_sento_hotel = new DOMPDF(); // Create new instance of dompdf
$dompdf_sento_hotel->load_html($pdf_html_hotel); // Load the html
$dompdf_sento_hotel->render(); // Parse the html, convert to PDF
$pdf_content_sento_hotel = $dompdf_sento_hotel->output(); // Put contents of pdf into variable for later

// @ Handle html for hotel email
// Get the contents of the HTML email into a variable for later
ob_start();
include("../sendmail/html_sento_hotel.php");
$html_message_sento_hotel = ob_get_contents();
ob_end_clean();

// Load the SwiftMailer files
require_once("../sendmail/swift/swift_required.php");

$mailer_hotel 	 = new Swift_Mailer(new Swift_MailTransport()); // Create new instance of SwiftMailer for hotel email
				
$message_hotel = Swift_Message::newInstance()
->setSubject('Hotel Booking : Confirmation') // Message subject
->setTo(array("[email protected]" => "[email protected]")) // Array of people to send to
->setCc(array("[email protected]" => "[email protected]" , "[email protected]" => "[email protected]"))
->setFrom(array("[email protected]" => 'Asian Trails')) // From:
->setBody($html_message_sento_hotel, 'text/html') // Attach that HTML message from earlier
->attach(Swift_Attachment::newInstance($pdf_content_sento_hotel, 'reservation.pdf', 'application/pdf')); // Attach the generated PDF earlier


// Send the email, and show user message
$mailer_hotel->send($message_hotel);


จาก Code ด้านบนผมจะทำยังไงให้มันส่ง 1 Mail ได้หลาย Attach file คือต้องการส่ง 2 PDF ต่อ 1 Mail ครับ



Tag : PHP









ประวัติการแก้ไข
2018-02-27 11:47:46
2018-02-27 11:48:22
Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2018-02-27 11:43:12 By : nut_ch31 View : 756 Reply : 2
 

 

No. 1



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

Hall of Fame 2012

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


ถ้ามันเป็น Object คุณสามารถเขียนเชิงวัตถุเข้าไปได้เลย "จับอะไรยัดเข้าไปในซองก็ได้ไม่ต้องคิดมากแค่เปิดซองก็พอ"
Code (PHP)
$attachment = Swift_Attachment::newInstance('This is the plain text attachment.', 'hello.txt', 'text/plain');
$attachment2 = Swift_Attachment::newInstance('This is the plain text attachment.', 'hello.txt', 'text/plain');
$attachment2->setDisposition('inline');
$message->attach($attachment);
$message->attach($attachment2);









ประวัติการแก้ไข
2018-02-27 12:14:14
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2018-02-27 12:12:56 By : dudesaranyu
 


 

No. 2



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



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


ตอบความคิดเห็นที่ : 1 เขียนโดย : dudesaranyu เมื่อวันที่ 2018-02-27 12:12:56
รายละเอียดของการตอบ ::
ออหรอครับ ผมก็หลง ทำเป็น array ตั้งนาน ขอบพระคุณครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2018-02-27 13:41:02 By : nut_ch31
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : สอบถามครับ ผมใช้ Function ส่งเมล์ โดยสามารถแนบเอกสารเป็น File PDF ได้แล้วครับ แต่ผมอยากให้มันส่ง File PDF ให้ได้ 2 ฉบับต่อ 1 เมล์ ทำอย่างไรครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 00
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 อัตราราคา คลิกที่นี่