gpt4 book ai didi

PHPMailer 附件,在没有物理文件的情况下执行

转载 作者:IT王子 更新时间:2023-10-29 00:20:40 28 4
gpt4 key购买 nike

所以:

// 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(),当我在这里添加附件时,我传递了文件名和内容,它们应该在其中。

像这样:

$xmail->addAttachment('myamazingfile.pdf', $content);

我怎样才能让它以同样的方式工作,所以当我从 PHPmailer 类调用 AddAttachment() 时,我可以传递相同的或类似的东西,所以我不需要我服务器上要发送的实际文件?

最佳答案

AddStringAttachment($string,$filename,$encoding,$type)

例如

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

https://phpmailer.github.io/PHPMailer/classes/PHPMailer-PHPMailer-PHPMailer.html#method_addStringAttachment

关于PHPMailer 附件,在没有物理文件的情况下执行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11164167/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com