I am currently trying to generate a pdf with FPDF and then send it in an email with PHPMailer. I know that the PHPMailer functionality is working, and I can create the pdf. But
You just need to fix your permissions. If FPDF can't write the file, then there's nothing for PHPMailer to send, so of course it won't work.
Alternatively you can render to a string and attach that instead - this way it doesn't need to write a file:
$pdfdoc = $pdf->Output('', 'S');
...
$mail->addStringAttachment($pdfdoc, 'my-doc.pdf');