$remote_path = 'http://bucket.s3.amazonaws.com/whatever.txt';
$mail->AddAttachment($remote_path);
这不起作用,因为PHPMailer需要本地文件或二进制数据。它也试过这样做:
$data = file_get_contents($remote_path);
$mail->AddAttachment($data);
如果没有必要,我不想把它下载到本地文件。为什么file_get_contents
版本不能工作?它是字符串而不是二进制数据吗?
编辑:没有错误
您应该看看另一个phpmailer函数AddStringAttachment:
AddStringAttachment($string, $filename, $encoding = 'base64', $type = 'application/octet-stream')
3.2 http://phpmailer.worxware.com/index.php?pg=tutorial