Announcement

Collapse
No announcement yet.

php - PHPMailer Attachment error

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Nimbus
    replied
    Hi Aiden,
    I would suggest you to try the full path to the attachment.
    i.e.
    $mail->addAttachment('/full/path/to/attach/file.pdf', 'file.pdf');
    $mail->addAddress($to);

    Leave a comment:


  • Aiden
    started a topic php - PHPMailer Attachment error

    php - PHPMailer Attachment error

    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.';
    }
Working...
X