E-mail activation not working with php mail

I am still confused as to where the .html part is from?

The “.html” part is written by myself, it doesn’t come from anywhere. .html is just an extension for the final file.

I have a parse error here but I thought it should be correct? Something about a dot error

$newfile = …/invoice/PrimerLevelAccount_“.$uid.”_“.$date.”;

I am still getting a parse error but I think the following should be correct:

$newfile = …/invoice/PrimerLevelAccount_“.$uid.”_“.$date”;

I got rid of the last dot…

$newfile = "../invoice/PrimerLevelAccount_".$uid."_".$date.".html";
is the new line that doesn’t give the Parse Error.

Ok… Do I need the opening quotation after $newfile?

Yes, you must need it otherwise it gives a Parse Error.

But I am not including the .html part though… so would my code be?

$newfile = “…/invoice/PrimerLevelAccount_”.$uid.“_”.$date"";

Then the new code will be $newfile = "../invoice/PrimerLevelAccount_".$uid."_".$date;, WITHOUT THE TRIPLE DOT TO THE STARTING OF THE LOCATION!, but ensuring that the PHP is in a directory and the invoice directory is a level up the directory of the PHP file.

I have the following errors but I have got a folder called invoice though…

Warning : fopen(invoice/PrimerLevelAccount_piano0011_2019-06-15): failed to open stream: No such file or directory in /home/vol11_8/epizy.com/epiz_24034628/pianocourse101.com/htdocs/signup2.php on line 552

Warning : fwrite() expects parameter 1 to be resource, boolean given in /home/vol11_8/epizy.com/epiz_24034628/pianocourse101.com/htdocs/signup2.php on line 553

Warning : fclose() expects parameter 1 to be resource, boolean given in /home/vol11_8/epizy.com/epiz_24034628/pianocourse101.com/htdocs/signup2.php on line 554
Your message was sent successfully!

The signup2.php is on the htdocs folder, so: $newfile = "./invoice/PrimerLevelAccount_".$uid."_".$date;. REMEMBER TO ALWAYS USE QUOTATION MARKS! And open $newfile with the “w” mode always with the fopen().

thanks but I have a double … as in

`$newfile = “…/invoice/PrimerLevelAccount_”.$uid.“_”.$date;

whereas you have a single dot, what is the difference between the two?

$newfile = "./invoice/PrimerLevelAccount_".$uid."_".$date; ,

I guess the …/ means to go back a folder… oops

Fun Fact: On Windows there is a secret ... folder that goes to the same folder as before and cannot be deleted after being created.
But on Linux the . means to search the file to the same folder as before, and .. means to go up a folder. On this forum the .. transforms to …

really? sounds interesting! Should this line of code work as well?

$newfile = “invoice/PrimerLevelAccount_”.$uid.“_”.$date;

Yes, this line of code should work as well, considering that the file signup2.php is on the htdocs folder.

I still have a similar error:

Warning : fopen(./invoice/PrimerLevelAccount_piano0011_2019-06-15): failed to open stream: No such file or directory in /home/vol11_8/epizy.com/epiz_24034628/pianocourse101.com/htdocs/signup2.php on line 552

Warning : fwrite() expects parameter 1 to be resource, boolean given in /home/vol11_8/epizy.com/epiz_24034628/pianocourse101.com/htdocs/signup2.php on line 553

Warning : fclose() expects parameter 1 to be resource, boolean given in /home/vol11_8/epizy.com/epiz_24034628/pianocourse101.com/htdocs/signup2.php on line 554
Your message was sent successfully!

Try to use this code:
$date = date("Ymd");
$newfile = "./invoice/PrimerLevelAccount_".$uid."_".$date.".html";
$file = fopen($newfile, "w");
echo fwrite($file,$mail->Body);
fclose($file);
$mail->addAttachment($newfile);
The message body should be in HTML, because you defined the function isHTML(bool) on the code (bool is the boolean value).

So I should append the .html even though I don’t have the html? I thought that date should be Y-m-d with a dash?

The date function can be used in so many syntaxes. For the time.php script I used this date syntax: date("H:i:s");.

I forgot to change the +w and you also did mention this earlier… I am so silly… but I guess programming is a great way to learn about syntax error…