I'm sending an email using PHPMailer and this works fine:
$mail->Subject = "My Email Subject";
$mail->msgHTML(file_get_contents('emailcontent.html'), __DIR__);
$mail->send();
The file 'emailcontent.html' is in the current directory and it works.
Now I want to move the 'emailcontent.html' file into subdirectory 'emails/emailcontent.html'.
I tried this ...
$mail->msgHTML(file_get_contents('emailcontent.html'), __DIR__.'/emails/');
... and this ...
$mail->msgHTML(file_get_contents('/emails/emailcontent.html'), __DIR__);
... but neither worked.
What am I doing wrong?
Thanks to @RiggsFolly for straightening me out ... the problem was an errant /
.
This works:
$mail->msgHTML(file_get_contents('emails/emailcontent.html'), __DIR__);