Dan Dan - 1 month ago 12
PHP Question

PHPMailer Master not sending Email

I am trying to send an email with a .PDF attached using PHPMailer Master.

I am receiving no email, seeing no errors and cannot understand what's going on.

Here is my code:

$url = ''. $_SERVER['DOCUMENT_ROOT'] .'/free-quote/';

$mail = new PHPMailer;
$mail->setFrom('removed@email.com', 'Company Name');
$mail->addAddress(''. $email2 .'', ''. $full_name .'');
$mail->Subject = 'Website Quotation ('. $quotation_ref .')';
$mail->addStringAttachment(file_get_contents($url), ''. $quotation_ref .'.pdf');
$mail->Body = 'Hi! This is my first e-mail sent through PHPMailer.';

I have also included the required file:




From the PHPMailer Docs:

    if(!$mail->send()) {
      echo 'Message could not be sent.';
      echo 'Mailer Error: ' . $mail->ErrorInfo;
    } else {
      echo 'Message has been sent';