$to = 'chanchalmaiti@nextagsolutions.com'; $subject = 'New Quote Request - NexTAG Website'; $body = "New quotation request from the NexTAG website\n\n" . "Name: $name\n" . "Company: $company\n" . "Email: $email\n" . "Phone: $phone\n" . "Product / Solution: $product\n" . "Quantity: $quantity\n\n" . "Requirements:\n$message\n"; require_once __DIR__ . '/PHPMailer/src/Exception.php'; require_once __DIR__ . '/PHPMailer/src/PHPMailer.php'; require_once __DIR__ . '/PHPMailer/src/SMTP.php'; $mail = new \PHPMailer\PHPMailer\PHPMailer(true); try { $mail->isSMTP(); $mail->Host = 'smtp-relay.gmail.com'; $mail->SMTPAuth = false; $mail->SMTPSecure = \PHPMailer\PHPMailer\PHPMailer::ENCRYPTION_STARTTLS; $mail->Port = 587; $mail->CharSet = 'UTF-8'; $mail->setFrom( 'chanchalmaiti@nextagsolutions.com', 'NexTAG Website' ); $mail->addAddress($to); $mail->addReplyTo($email, $name); $mail->Subject = $subject; $mail->Body = $body; $mail->isHTML(false); $mail->send(); $success = true; $name = $company = $email = $phone = ''; $product = $quantity = $message = ''; } catch (\PHPMailer\PHPMailer\Exception $e) { error_log('NexTAG quote email failed: ' . $mail->ErrorInfo); $error = 'Your request could not be emailed right now. Please try again or contact chanchalmaiti@nextagsolutions.com directly.'; }