简体   繁体   中英

HowTo? Debug PHPMailer function as it is not working

I have a couple of websites and my host has PHPMailer enabled.

On a wordpress site I also installed a plugin which returned this result:

bool(true)
The full debugging output is shown below:
object(PHPMailer)#81 (69) {
  ["Version"]=>
  string(5) "5.2.7"
  ["Priority"]=>
  int(3)
  ["CharSet"]=>
  string(5) "UTF-8"
  ["ContentType"]=>
  string(10) "text/plain"
  ["Encoding"]=>
  string(4) "8bit"
  ["ErrorInfo"]=>
  string(0) ""
  ["From"]=>
  string(23) "test@gmail.com"
  ["FromName"]=>
  string(10) "StackOverflow"
  ["Sender"]=>
  string(23) "test@gmail.com"
  ["ReturnPath"]=>
  string(0) ""
  ["Subject"]=>
  string(48) "WP Mail SMTP: Test mail to test@gmail.com"
  ["Body"]=>
  string(68) "This is a test email generated by the WP Mail SMTP WordPress plugin."
  ["AltBody"]=>
  string(0) ""
  ["Ical"]=>
  string(0) ""
  ["MIMEBody":protected]=>
  string(69) "This is a test email generated by the WP Mail SMTP WordPress plugin.
"
  ["MIMEHeader":protected]=>
  string(356) "Date: Tue, 14 Apr 2015 03:57:46 +0000
Return-Path: 
From: Test Test 
Message-ID: <8c0bcf9002be1e7eba1b4e3a2282c3d5@domain.com>
X-Priority: 3
X-Mailer: PHPMailer 5.2.7 (https://github.com/PHPMailer/PHPMailer/)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
"
  ["mailHeader":protected]=>
  string(84) "To: test@gmail.com
Subject: WP Mail SMTP: Test mail to test@gmail.com
"
  ["WordWrap"]=>
  int(0)
  ["Mailer"]=>
  string(4) "mail"
  ["Sendmail"]=>
  string(18) "/usr/sbin/sendmail"
  ["UseSendmailOptions"]=>
  bool(true)
  ["PluginDir"]=>
  string(0) ""
  ["ConfirmReadingTo"]=>
  string(0) ""
  ["Hostname"]=>
  string(0) ""
  ["MessageID"]=>
  string(0) ""
  ["MessageDate"]=>
  string(0) ""
  ["Host"]=>
  string(9) "localhost"
  ["Port"]=>
  int(25)
  ["Helo"]=>
  string(0) ""
  ["SMTPSecure"]=>
  string(0) ""
  ["SMTPAuth"]=>
  bool(false)
  ["Username"]=>
  string(0) ""
  ["Password"]=>
  string(0) ""
  ["AuthType"]=>
  string(0) ""
  ["Realm"]=>
  string(0) ""
  ["Workstation"]=>
  string(0) ""
  ["Timeout"]=>
  int(10)
  ["SMTPDebug"]=>
  bool(true)
  ["Debugoutput"]=>
  string(4) "echo"
  ["SMTPKeepAlive"]=>
  bool(false)
  ["SingleTo"]=>
  bool(false)
  ["SingleToArray"]=>
  array(0) {
  }
  ["do_verp"]=>
  bool(false)
  ["AllowEmpty"]=>
  bool(false)
  ["LE"]=>
  string(1) "
"
  ["DKIM_selector"]=>
  string(0) ""
  ["DKIM_identity"]=>
  string(0) ""
  ["DKIM_passphrase"]=>
  string(0) ""
  ["DKIM_domain"]=>
  string(0) ""
  ["DKIM_private"]=>
  string(0) ""
  ["action_function"]=>
  string(0) ""
  ["XMailer"]=>
  string(0) ""
  ["smtp":protected]=>
  NULL
  ["to":protected]=>
  array(1) {
    [0]=>
    array(2) {
      [0]=>
      string(21) "test@gmail.com"
      [1]=>
      string(0) ""
    }
  }
  ["cc":protected]=>
  array(0) {
  }
  ["bcc":protected]=>
  array(0) {
  }
  ["ReplyTo":protected]=>
  array(0) {
  }
  ["all_recipients":protected]=>
  array(1) {
    ["test@gmail.com"]=>
    bool(true)
  }
  ["attachment":protected]=>
  array(0) {
  }
  ["CustomHeader":protected]=>
  array(0) {
  }
  ["lastMessageID":protected]=>
  string(51) "<8c0bcf9002be1e7eba1b4e3a2282c3d5@domain.com>"
  ["message_type":protected]=>
  string(5) "plain"
  ["boundary":protected]=>
  array(3) {
    [1]=>
    string(35) "b1_8c0bcf9002be1e7eba1b4e3a2282c3d5"
    [2]=>
    string(35) "b2_8c0bcf9002be1e7eba1b4e3a2282c3d5"
    [3]=>
    string(35) "b3_8c0bcf9002be1e7eba1b4e3a2282c3d5"
  }
  ["language":protected]=>
  array(0) {
  }
  ["error_count":protected]=>
  int(0)
  ["sign_cert_file":protected]=>
  string(0) ""
  ["sign_key_file":protected]=>
  string(0) ""
  ["sign_key_pass":protected]=>
  string(0) ""
  ["exceptions":protected]=>
  bool(true)
}

How can I debug and test this to figure out a solution as none of my on line forms are sending.

Any workarounds would be appreciated too though I've already considered using SMTP and prefer not to... I have tried the classic mail() function and that did not work either.

Thank you.

According to your Object dump, your SMTP property is NULL which in most cases will mean that it is not configured properly. If you could provide the code sample that is trying to use the PHPMailer or at least some details on the current configuration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM