如何通过邮件发送存储在mysql数据库中的文件。 当我将其下载到' ../ uploads /'。
之后我尝试发送它。if ($attachment != '') {
$crlf = "\n";
$mime = new Mail_mime($crlf);
$mime->setTXTBody($message);
$mime->addAttachment('../uploads/file.xls');
$body = $mime->get();
$headers = $mime->headers($headers);
} else {
$body = $message;
}
$smtp = Mail::factory('smtp', array ('host' => $host));
$mail = $smtp->send($recipient, $headers, $body);
我怎样才能做到这一点
$mime->addAttachment('../uploads/file.xls');
从db?
中读取文件我会感谢任何提示。
问候
亚历
答案 0 :(得分:0)
阅读documentation for the Mail_Mime
PEAR package后,以下内容也应有效:
$mime->addAttachment(
$fileContent,
'application/octet-stream',
$suggestedFileName,
false # First parameter is content, not a filename.
);