Issue
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?
Solution
Thanks to @RiggsFolly for straightening me out ... the problem was an errant /
.
This works:
$mail->msgHTML(file_get_contents('emails/emailcontent.html'), __DIR__);
Answered By - AndySummers2020 Answer Checked By - Clifford M. (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.