Hi All,
I am using PHPMailer to send out emails (one at a time, as and when type thing) in SMTP mode. The emails have a dynamic PDF attached which I dont want to keep after sending, therefore remove from the server.
Once PHPMailer has been started, do I need to wait before deleting the file? as in the example code below
// After email with PDF is mailed, need to remove the certificate from the server
sleep(4); // Delay for 4 seconds
unlink("/home/username/public_html/certificates/".$filename); // remove the PDF
// Alternative, set a cron job to unlink all certs that have a timestamp 2 hours old