I have this PHP code to attach a document to an email:
require('./PHPMailer_v5.1/class.phpmailer.php');
$mail = new PHPMailer();
$mail->Username = "xxxxx.com";
$mail->Password = "xxxx";
$mail->Host = "smtp.office365.com";
$mail->Mailer = "smtp";
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = TRUE;
$mail->SMTPSecure = "tls";
$mail->Port = 587;
$mail->SetFrom("xxxxx.com", "Pay Slip");
$mail->AddReplyTo("xxx", "Pay Slip");
$filename = $_SERVER['DOCUMENT_ROOT'] . '/' . 'Payslip/admin/salaryslip' . '/' . $row['year'];
$fullfilepath='employyee.pdf'
$filename2 = $filename . '/' . $row['month'] . '/' . $fullfilepath;
$mail->AddAttachment($filename2, $subject, $encoding = 'base64', $type = 'application/pdf');
The email sends successfully with the attachment, but the .pdf
extension is missing in the received mail. Any help would be appreciated.