when we tested the certificate module at UMN, with the emailing option enabled (thus, saving enabled), sometimes it would error (cannot find files), sometimes it would send the wrong certificate (the certificate attached to email belongs to another student).
Tracing the codes, I found that although function certificate_save_pdf() saves the PDF with $certificateid (lib.php, around line 616 and 623), view.php actually passes in $certrecord->id (which is certificate_issue.id) around line 142.
The function certificate_email_students() is consistent with the variable naming in certificate_save_pdf(), tries to get the PDF with $certificate->id (around line 514, using get_area_files), whereas it should be $certrecord->id.
Our QA tested the change and confirmed that it fixes the problem described above.
Forgive me for being too lazy to whip up a patch