php - 在 PHPMailer 中使用变量的内容作为附件

标签 php phpmailer

我想这样做:

$mail = new PHPMailer;
$mail->AddAttachment('text in file', 'file.txt');

所以附件可以有动态内容。我现在只能使用真实文件作为附件。显然,真正的文件是静态的,我想动态生成一些内容并将其附加到邮件中。一定有某种方法可以做到,我想这不是那个晦涩的功能。有人知道吗?

最佳答案

$mail->AddStringAttachment($string,$filename,$encoding,$type);

http://phpmailer.worxware.com/?pg=tutorial#3

关于php - 在 PHPMailer 中使用变量的内容作为附件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16726136/

相关文章:

php - 2表什么被删除了?

php - Centos无法安装mysqli

php - 从 the_posts_pagination 中删除来自 h2 的 screen_reader_text

PHPMailer、AddStringAttachment 和数据 URI 方案

插入 MySQL 数据库的 PHP PDO 代码不起作用

php - 如何从php获取变量到数组?

php - 使用 mPDF 和 PHPmailer 即时附加 PDF

PHPMailer 5.2.0 每次发出2封邮件

Phpmailer 遇到变音问题

image - 如何获取使用 webpack encore 生成的图像的路径