Use variable content as an attachment in PHPMailer

I want to do this:

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

therefore, an attachment can have dynamic content. I can use only the real file as an application. Obviously, the real file is static, I want to dynamically generate some content and attach it to the mail. There must be some way to do this, I think this is not such an obscure feature. Does anyone know how?

+4
source share
2 answers
 $mail->AddStringAttachment($string,$filename,$encoding,$type); 

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

+6
source

See addStringAttachement () in the documentation

+1
source

Source: https://habr.com/ru/post/1482487/


All Articles