Far*_*her 2 php attachment phpmailer email-attachments
$remote_path = 'http://bucket.s3.amazonaws.com/whatever.txt';
$mail->AddAttachment($remote_path);
Run Code Online (Sandbox Code Playgroud)
这不起作用,因为PHPMailer需要本地文件或二进制数据.它也尝试了这个:
$data = file_get_contents($remote_path);
$mail->AddAttachment($data);
Run Code Online (Sandbox Code Playgroud)
如果我不需要,我不想将其下载到本地文件中.为什么file_get_contents版本不起作用?它是字符串而不是二进制数据吗?
编辑:我没有错误.
您应该看看另一个名为AddStringAttachment的phpmailer函数:
AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream')
http://phpmailer.worxware.com/index.php?pg=tutorial#3.2
| 归档时间: |
|
| 查看次数: |
5811 次 |
| 最近记录: |