I know how to read a file on a server and attach it to email in PHP, but I wanted to know if I can attach a file that was created by my script but not created on the server (sort of like a temporary file).
So, create a file in memory and attach it to the email.
Bonus: you may need to create several files, will it be too much to process the server? I do not say GB, but how are 5 files with 1000 lines each?
, , - , , . , ! , 5 , 1993 .
, - - :
$myEmail->attachData('file.name', 'mime/type', $data);
, php://memory:
$f = fopen('php://memory/myfile', 'w'); fwrite($f, '...'); fclose($f); $myEmail->attach('php://memory/myFile');