Hi,
I want to send emails with attachments but I'm getting the PHPMailer Attachment error. Any help will be highly appreciated.
$mail = new PHPMailer();
$mail->Host = "localhost"; // SMTP server
$mail->From = $dwwp_email;
$mail->FromName = "Title Name";
$mail->addReplyTo($dwwp_email);
$mail->IsHTML('true');
$mail->Username = "Username";
$mail->Password = "Password";
$mail->AddAddress($to);
$mail->Subject = $subject;
$mail->AddAttachment('../attach/file.pdf', 'file.pdf');
$mail->Body = $message;
if (!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.';
}
I want to send emails with attachments but I'm getting the PHPMailer Attachment error. Any help will be highly appreciated.
$mail = new PHPMailer();
$mail->Host = "localhost"; // SMTP server
$mail->From = $dwwp_email;
$mail->FromName = "Title Name";
$mail->addReplyTo($dwwp_email);
$mail->IsHTML('true');
$mail->Username = "Username";
$mail->Password = "Password";
$mail->AddAddress($to);
$mail->Subject = $subject;
$mail->AddAttachment('../attach/file.pdf', 'file.pdf');
$mail->Body = $message;
if (!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.';
}
Comment