2010-08-27 107 views
0

我有一個頁面,「文件」的HTML輸入字段和「提交」,如下按鈕:在PHP中的電子郵件附件?

<form id="formUploadfile" name="formUploadfile" method="post" action="" class="form" enctype="multipart/form-data"> 
     <label for="name"><strong>File</strong></label> 
     <input type="file" name="uploaded_file" size="35" /> 
     <button type="submit" class="btn_common" id="inquiry_submit" name="inquiry_submit"> 
      Submit 
     </button> 
    </form> 

我要選擇的文件發送到預先定義的電子郵件地址。在PHP中,我需要先將文件上傳到我的服務器,然後再將它作爲附件電子郵件發送給我?或者沒有上傳到服務器,它將工作。

我谷歌搜索,但沒有找到上述問題的答案,請幫助。如果任何人有相同目的的代碼,請提供鏈接。

謝謝

+0

[PHP發送郵件附件](http://stackoverflow.com/questions/3386492/php-sending-mail-attachments) – 2010-08-27 09:30:10

回答

2

是的,您需要先將文件上傳到服務器。

使用郵件類如Swiftmailer來發送文件。

+2

可能也需要指向OP http://stackoverflow.com/問題/ 3386492/php-sending-mail-attachments – Gordon 2010-08-27 09:28:43

+0

@戈登那是我正在尋找的人 - 投票關閉作爲一個騙局 – 2010-08-27 09:30:24