Home > OS >  Laravel PHP Panel E-mail Send Problem Help Me Please
Laravel PHP Panel E-mail Send Problem Help Me Please

Time:07-13

   [2022-07-13 00:12:29]
     local.ERROR: Call to undefined function PHPMailer\PHPMailer\escapeshellcmd() {"exception":"[object] (Error(code: 0): Call to undefined function PHPMailer\\PHPMailer\\escapeshellcmd() at public_html/Upverse/core/vendor/phpmailer/phpmailer/src/PHPMailer.php:1794)
    [stacktrace]
    
    #0 public_html/Upverse/core/vendor/phpmailer/phpmailer/src/PHPMailer.php(1887): PHPMailer\\PHPMailer\\PHPMailer::isShellSafe()
    
    #1 public_html/Upverse/core/vendor/phpmailer/phpmailer/src/PHPMailer.php(1650): PHPMailer\\PHPMailer\\PHPMailer->mailSend()
    
    #2 public_html/Upverse/core/vendor/phpmailer/phpmailer/src/PHPMailer.php(1486): PHPMailer\\PHPMailer\\PHPMailer->postSend()
    
    #3 public_html/Upverse/core/app/Http/Controllers/Front/FrontendController.php(804): PHPMailer\\PHPMailer\\PHPMailer->send()
    
    
    .env
    settings;
    
    MAIL_DRIVER=mail
    MAIL_HOST=mail.****.com
    MAIL_PORT=587
    MAIL_USERNAME=contact@****.com
    MAIL_PASSWORD=*****
    MAIL_ENCRYPTION=tls

CodePudding user response:

i think you called the mailer in a wrong way. please show the codes so i can give u solution.

CodePudding user response:

Upverse/sendquote" enctype="multipart/form-data" method="POST">

(1887)* if (empty($this->Sender) && !empty(ini_get('sendmail_from'))) { //PHP config has a sender address we can use

        $this->Sender = ini_get('sendmail_from');
    }
    if (!empty($this->Sender) && static::validateAddress($this->Sender)) {
        if (self::isShellSafe($this->Sender)) {
            $params = sprintf('-f%s', $this->Sender);
        }
        $old_from = ini_get('sendmail_from');
        ini_set('sendmail_from', $this->Sender);
    }
    $result = false;
    if ($this->SingleTo && count($toArr) > 1) {
        foreach ($toArr as $toAddr) {
            $result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params);
            $addrinfo = static::parseAddresses($toAddr, true, $this->charSet);
            $this->doCallback(
                $result,
                [[$addrinfo['address'], $addrinfo['name']]],
                $this->cc,
                $this->bcc,
                $this->Subject,
                $body,
                $this->From,
                []
            );
        }
    } else {

CodePudding user response:

(1486)*

        return $this->postSend();
    } catch (Exception $exc) {
        $this->mailHeader = '';
        $this->setError($exc->getMessage());
        if ($this->exceptions) {
            throw $exc;
        }

        return false;
    }
}

frontendcontroller.php (804)* try {

        $mail = new PHPMailer(true);
        $mail->setFrom($from, $request->name);
        $mail->addAddress($to);     // Add a recipient

        // Content
        $mail->isHTML(true);  // Set email format to HTML
        $mail->Subject = $subject;
        $mail->Body    = $message;

        $mail->send();
    } catch (\Exception $e) {
        // die($e->getMessage());
    }

    Session::flash('success', 'Email sent successfully!');
    return back();
}

CodePudding user response:

(1650)*

public function postSend() {

    try {
        //Choose the mailer and send through it
        switch ($this->Mailer) {
            case 'sendmail':
            case 'qmail':

                return $this->sendmailSend($this->MIMEHeader, $this->MIMEBody);
            case 'smtp':
                return $this->smtpSend($this->MIMEHeader, $this->MIMEBody);
            case 'mail':
                return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
            default:
                $sendMethod = $this->Mailer . 'Send';
                if (method_exists($this, $sendMethod)) {
                    return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody);
                }

                return $this->mailSend($this->MIMEHeader, $this->MIMEBody);
        }
    } catch (Exception $exc) {
        if ($this->Mailer === 'smtp' && $this->SMTPKeepAlive == true) {
            $this->smtp->reset();
        }
        $this->setError($exc->getMessage());
        $this->edebug($exc->getMessage());
        if ($this->exceptions) {
            throw $exc;
        }
    }

    return false;
}
  • Related