PHPmailer without using SMTP

后端 未结 2 1779
面向向阳花
面向向阳花 2021-02-08 22:08

I\'ve added the PHPMailer folder to my root folder on my web server and I just get an error that has to do with SMTP.

Is there a way to use PHPMailer without needing to

2条回答
  •  执笔经年
    2021-02-08 22:11

    Joseph Kreifels II is correct.

    In particular, see the comments in the class.phpmailer.php file:

    /**
     * Sets Mailer to send message using SMTP.
     * @return void
     */
    public function IsSMTP() {
       $this->Mailer = 'smtp';
    }
    
    /**
     * Sets Mailer to send message using PHP mail() function.
     * @return void
     */
    public function IsMail() {
      $this->Mailer = 'mail';
    }
    
    /**
     * Sets Mailer to send message using the $Sendmail program.
     * @return void
     */
    public function IsSendmail() {
      if (!stristr(ini_get('sendmail_path'), 'sendmail')) {
        $this->Sendmail = '/var/qmail/bin/sendmail';
      }
      $this->Mailer = 'sendmail';
    }
    

    So, be sure to remove $mail->IsSMTP(); from your settings, but also you may need to add $mail->IsMail(); or $mail->IsSendmail(); depending on your server setup.

提交回复
热议问题