ThaiSEOBoard.com

พัฒนาเว็บไซต์ => Programming => ข้อความที่เริ่มโดย: seoห่วยแตก ที่ 17 กันยายน 2013, 22:59:52



หัวข้อ: สอบถามเรื่องสคริปส่งเมล์แนบไฟล์
เริ่มหัวข้อโดย: seoห่วยแตก ที่ 17 กันยายน 2013, 22:59:52
<?php 
 include("mimemail.inc.php"); 
 $mail = new MIMEMAIL("HTML"); // ส่งแบบ HTML 
 $mail->senderName = "sender name"; // ชื่อผู้ส่ง 
 $mail->senderMail = "sender@email"; // อีเมลล์ผู้ส่ง 
 $mail->bcc = "bcc@email"; // ส่งแบบ bind carbon copy 
 $mail->subject = "หัวข้อจดหมาย"; // หัวข้ออีเมลล์ 
 $mail->body = "ข้อความในจดหมาย";   // ข้อความ หรือ HTML ก็ได้ 
 $mail->attachment[] = "path_to_file1/filename1"; // ระบุตำแหน่งไฟล์ที่จะแนบ 
 $mail->create(); 
 $mail->send("recipient1@email"); // เมลล์ผู้รับ 
?>

ผมใช้สคริปส่งเมล์อันนี้ แล้วผมต้องการให้ผู้ส่งแนบไฟล์จากเครื่องของเขามาในเมล์
ต้องแก้ path_to_file1/filename1 เป็นอะไรครับ
เพราะเท่าที่ลองๆแก้มันแนบไฟล์จากโฮสของเรามาแทน - -*

 :wanwan017:


หัวข้อ: Re: สอบถามเรื่องสคริปส่งเมล์แนบไฟล์
เริ่มหัวข้อโดย: zankumuro ที่ 17 กันยายน 2013, 23:42:47
ทำฟอร์มให้ผู้ส่งอัพโหลดรูปเข้ามาก่อนครับ แล้วจึงค่อยอ้างอิงที่อยู่รูปที่อัพโหลดเข้ามา


หัวข้อ: Re: สอบถามเรื่องสคริปส่งเมล์แนบไฟล์
เริ่มหัวข้อโดย: seoห่วยแตก ที่ 18 กันยายน 2013, 00:38:02
อันนี้ฟอร์มครับ

<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>SEND MAIL TEST</title>
</head>

<body>
<form action="sendEmail.php" method="post" enctype="multipart/form-data" name="f1">
           <table width="500" border="0" align="center" cellpadding="0" cellspacing="10">
              <tr>
                <td align="right">หัวเรื่อง</td>
                <td align="left"><input name="txt_subj" id="txt_subj" type="text" /></td>
              </tr>
              <tr>
                <td align="right">ชื่อ - นามสกุล</td>
                <td align="left"><input name="txt_name" id="txt_name" type="text" /></td>
              </tr>
              <tr>
                <td align="right">เบอร์โทรศัพท์</td>
                <td align="left"><input name="txt_tel" id="txt_tel" type="text" /></td>
              </tr>
              <tr>
                <td align="right">E-mail</td>
                <td align="left"><input name="txt_email" id="txt_email" type="text" /></td>
              </tr>
              <tr>
                <td align="right">รายละเอียด</td>
                <td align="left"><textarea name="area_detail" id="area_detail" cols="40" rows="5"></textarea></td>
              </tr>
              <tr>
                <td align="right">แนบรูป</td>
                <td align="left"><label>
                  <input type="file" name="fileField" id="fileField">
                </label></td>
              </tr>
              <tr>
                <td align="right">&nbsp;</td>
                <td align="left"><input type="file" name="fileField2" id="fileField2"></td>
              </tr>
              <tr>
                <td align="right">&nbsp;</td>
                <td align="left">
                   <input name="submit" id="submit" type="submit" value="ส่ง" style="width:80px; height:30px;" />
                    <input name="reset" type="reset" value="ล้างหน้าจอ" style="width:80px; height:30px;" />                 </td>
              </tr>
            </table>
</form>

</body>
</html>