isSMTP(); $phpmailer->Host = $smtp_host; // Your SMTP host $phpmailer->SMTPAuth = true; $phpmailer->Username = $smtp_username ; // SMTP username $phpmailer->Password = $smtp_password ; // SMTP password $phpmailer->SMTPSecure = "tls"; // TLS Encryption $phpmailer->Port = 587; // SMTP Port // Email Details $phpmailer->setFrom('no-reply@axilweb.com', 'Your Site Name'); // Replace with your sender info $phpmailer->addAddress($to); // Recipient $phpmailer->Subject = $subject; $phpmailer->Body = $message; $phpmailer->SMTPOptions = array( 'ssl' => array( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true ) ); if (!empty($headers)) { $phpmailer->addCustomHeader($headers); // Adding headers if available } // Send email return $phpmailer->send(); } catch (Exception $e) { // Log the error if email sending fails // error_log('PHPMailer SMTP error: ' . $phpmailer->ErrorInfo); return false; } } }