PHPMailer附件,无需物理文件即可完成 [英] PHPMailer attachment, doing it without a physical file
本文介绍了PHPMailer附件,无需物理文件即可完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
所以:
// Setup mail class, recipients and body
$mailer->AddAttachment('/home/mywebsite/public_html/file.zip', 'file.zip');
The AddAttachment function has four arguments:
AddAttachment(PATH_TO_FILE, FILENAME, ENCODING, HEADER_TYPE)
我曾经使用xmail(),当我在此处添加附件时,我传递了应包含在其中的文件名和内容.
I used to use xmail() and when I added a attachment here, I passed the filename and the content, that should be in it.
像这样:
$xmail->addAttachment('myamazingfile.pdf', $content);
如何使它以相同的方式工作,所以当我从PHPmailer类调用AddAttachment()
时,我可以传递相同的内容或类似的内容,因此我不需要在服务器上实际发送文件?
How can I make it work the same way, so when i call AddAttachment()
from the PHPmailer class, I can either pass the same or something like it, so I dont need to have a actual file on my server to send?
推荐答案
AddStringAttachment($string,$filename,$encoding,$type)
例如
$mail = new PHPMailer();
$mail->AddStringAttachment($string,$filename,$encoding,$type);
http://phpmailer.worxware.com/index.php?pg=tutorial#3
这篇关于PHPMailer附件,无需物理文件即可完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文