2008-11-03 82 views

回答

3

如果你有一個很難得到正確的頭,你可以隨時使用類似PHP Mailer,而不是重新發明輪子的。

0

你應該能夠按照these instructions上發送電子郵件附件。您只需調整代碼即可從數據庫中讀取字符串,而無需讀取文件的內容。

3

我喜歡梨。

<? 
include('Mail.php'); 
include('Mail/mime.php'); 
$text = 'Text version of email'; 
$html = '<html><body>HTML version of email</body></html>'; 
$file = './files/example.zip'; 
$crlf = "rn"; 
$hdrs = array(
       'From' => '[email protected]', 
       'To'  => '[email protected]', 
       'Subject' => 'Test mime message' 
      ); 
$mime = new Mail_mime($crlf); 
$mime->setTXTBody($text); 
$mime->setHTMLBody($html); 
$mime->addAttachment($file,'application/octet-stream'); 
$body = $mime->get(); 
$hdrs = $mime->headers($hdrs); 
$mail =& Mail::factory('mail', $params); 
$mail->send('[email protected]', $hdrs, $body); 
?> 
+0

1爲示例 – cletus 2009-01-20 01:14:56

相關問題