{"record":{"id":"4ad56658e2a8154c","repo":"ellite/Wallos","slug":"this-lang-instantiate","errorCode":null,"errorMessage":"$this->lang('instantiate')","messagePattern":"\\$this->lang\\('instantiate'\\)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"libs/PHPMailer/PHPMailer.php","lineNumber":1970,"sourceCode":"                    $result,\n                    [[$addrinfo['address'], $addrinfo['name']]],\n                    $this->cc,\n                    $this->bcc,\n                    $this->Subject,\n                    $body,\n                    $this->From,\n                    []\n                );\n            }\n        } else {\n            $result = $this->mailPassthru($to, $this->Subject, $body, $header, $params);\n            $this->doCallback($result, $this->to, $this->cc, $this->bcc, $this->Subject, $body, $this->From, []);\n        }\n        if (isset($old_from)) {\n            ini_set('sendmail_from', $old_from);\n        }\n        if (!$result) {\n            throw new Exception($this->lang('instantiate'), self::STOP_CRITICAL);\n        }\n\n        return true;\n    }\n\n    /**\n     * Get an instance to use for SMTP operations.\n     * Override this function to load your own SMTP implementation,\n     * or set one with setSMTPInstance.\n     *\n     * @return SMTP\n     */\n    public function getSMTPInstance()\n    {\n        if (!is_object($this->smtp)) {\n            $this->smtp = new SMTP();\n        }\n","sourceCodeStart":1952,"sourceCodeEnd":1988,"githubUrl":"https://github.com/ellite/Wallos/blob/52820e87ca5a6e105fdbb7f1c0c681bc0cfee2fd/libs/PHPMailer/PHPMailer.php#L1952-L1988","documentation":"Thrown by mailSend() when PHP's built-in mail() function returns false, meaning PHP could not even hand the message to the configured mail transfer agent. It is a critical STOP_CRITICAL error with the localized 'instantiate' message. Unlike the SMTP transports, mail() gives no detailed reason, so the error is intentionally terse.","triggerScenarios":"Calling $mailer->send() with isMail() (default transport) when mail() returns false: no sendmail_path configured, mail() disabled (sendmail_path empty or disable_functions), or invalid From header causing immediate rejection.","commonSituations":"PHP-FPM/Apache containers with no MTA installed and sendmail_path unset, shared hosts blocking mail(), Windows servers without a configured SMTP directive in php.ini, or ini_set('sendmail_from') failures.","solutions":["Check php.ini mail configuration: sendmail_path (Linux) or SMTP/smtp_port (Windows) must point to a working MTA.","Verify the From address is valid and allowed by the host (many hosts require a local domain sender).","Install/configure an MTA (msmtp, postfix) and set sendmail_path = \"/usr/sbin/msmtp -t\" if none exists.","Switch to SMTP transport: $mailer->isSMTP() with host/port/credentials, which gives better diagnostics.","Confirm mail() is not disabled via disable_functions in php.ini."],"exampleFix":"// before\n$mailer->isMail(); // mail() returns false: no MTA in container\n// after\n$mailer->isSMTP();\n$mailer->Host = 'smtp.example.com';\n$mailer->SMTPAuth = true;\n$mailer->Username = 'user@example.com';\n$mailer->Password = 'secret';\n$mailer->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS;\n$mailer->Port = 587;","handlingStrategy":"validation","validationCode":"$path = ini_get('sendmail_path');\nif (PHP_SHLIB_SUFFIX === 'so' && (empty($path) || in_array('mail', explode(',', ini_get('disable_functions') ?: '')))) {\n    // mail() will fail: use SMTP instead\n}","typeGuard":null,"tryCatchPattern":"try {\n    $mailer->send();\n} catch (PHPMailer\\PHPMailer\\Exception $e) {\n    if ($e->getMessage() === $mailer->lang('instantiate')) {\n        error_log('mail() failed: check sendmail_path / MTA; ' . $e->getMessage());\n    }\n}","preventionTips":["Check php.ini sendmail_path (or Windows SMTP settings) before relying on isMail().","Confirm mail() is not in disable_functions.","Install an MTA in the deployment environment or switch to SMTP.","Ensure the From address is allowed by the host's MTA policy."],"tags":["php","phpmailer","mail-function","email-delivery"],"backgroundTag":"missing-config-value","analyzedSha":"52820e87ca5a6e105fdbb7f1c0c681bc0cfee2fd","analyzedAt":"2026-09-13T14:09:30.873Z","contentChangedAt":"2026-09-13T14:09:30.873Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}