<?Php // Settings $name = "Name goes here"; $email = "[email protected]"; $to = "$email"; $from = "[email protected]"; $subject = "=?UTF-8?B?".base64_encode("รายงานเครื่อง สถานะต่างๆ")."?="; $mainMessage = "Hi, here's the file."; $fileatt = "pdf/MyPDF/MyPDFA3.pdf"; $fileatttype = "application/pdf"; $fileattname = "RYG_Item.pdf"; $headers = "From: $from"; // File $file = fopen($fileatt, 'rb'); $data = fread($file, filesize($fileatt)); fclose($file); // This attaches the file $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $message = "This is a multi-part message in MIME format.\n\n" . "-{$mime_boundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\n" . "Content-Transfer-Encoding: 7bit\n\n" . $mainMessage . "\n\n"; $data = chunk_split(base64_encode($data)); $message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatttype};\n" . " name=\"{$fileattname}\"\n" . "Content-Disposition: attachment;\n" . " filename=\"{$fileattname}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "-{$mime_boundary}-\n"; // Send the email if(mail($to, $subject, $message, $headers)) { echo "The email was sent."; } else { echo "There was an error sending the mail."; } ?>
$mail->AddAttachment('images/phpmailer.gif'); // attachment $mail->AddAttachment('images/phpmailer_mini.gif'); // attachment
<html> <head> <title>ThaiCreate.Com PHP Sending Email</title> </head> <body> <?php $strTo = "[email protected]"; $strSubject = "Test Send Mail"; $strMessage = "My Body & <b>My Description</b>"; //*** Uniqid Session ***// $strSid = md5(uniqid(time())); $strHeader = ""; $strHeader .= "From: [email protected]"; //$strHeader .= "Cc: Mr.Surachai Sirisart<[email protected]>"; //$strHeader .= "Bcc: [email protected]"; $strHeader .= "MIME-Version: 1.0\n"; $strHeader .= "Content-Type: multipart/mixed; boundary=\"".$strSid."\"\n\n"; $strHeader .= "This is a multi-part message in MIME format.\n"; $strHeader .= "--".$strSid."\n"; $strHeader .= "Content-type: text/html; charset=windows-874\n"; // or UTF-8 // $strHeader .= "Content-Transfer-Encoding: 7bit\n\n"; $strHeader .= $strMessage."\n\n"; //*** Attachment Files ***// $arrFiles[] = "A3.pdf"; $arrFiles[] = "A4.pdf"; for($i=0;$i<count($arrFiles);$i++) { if(trim($arrFiles[$i]) != "") { $strFilesName = $arrFiles[$i]; $strContent = chunk_split(base64_encode(file_get_contents($strFilesName))); $strHeader .= "--".$strSid."\n"; $strHeader .= "Content-Type: application/octet-stream; name=\"".$strFilesName."\"\n"; $strHeader .= "Content-Transfer-Encoding: base64\n"; $strHeader .= "Content-Disposition: attachment; filename=\"".$strFilesName."\"\n\n"; $strHeader .= $strContent."\n\n"; } } $flgSend = @mail($strTo,$strSubject,null,$strHeader); // @ = No Show Error // if($flgSend) { echo "Email Sending."; } else { echo "Email Can Not Send."; } ?> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง