SMTP错误:以下收件人失败:SMTP错误:以下收件人失败

时间:2019-10-23 10:20:31

标签: phpmailer

我正在使用以下class.phpmailer.php文件作为PHP站点上的注册系统的一部分,但出现以下错误。

我将phpmailer文件的顶部和错误消息放在底部,一旦在实时网站上提交表单,就会看到该错误消息。

  /////////////////////////////////////////////////
  // PROPERTIES, PUBLIC
  /////////////////////////////////////////////////
  /**
   * Email priority (1 = High, 3 = Normal, 5 = low).
   * @var int
   */
  public $Priority          = 3;
  /**
   * Sets the CharSet of the message.
   * @var string
   */
  public $CharSet           = 'iso-8859-1';
  /**
   * Sets the Content-type of the message.
   * @var string
   */
  public $ContentType       = 'text/plain';
  /**
   * Sets the Encoding of the message. Options for this are
   *  "8bit", "7bit", "binary", "base64", and "quoted-printable".
   * @var string
   */
  public $Encoding          = '8bit';
  /**
   * Holds the most recent mailer error message.
   * @var string
   */
  public $ErrorInfo         = '';
  /**
   * Sets the From email address for the message.
   * @var string
   */
  public $From              = 'noreply@domain.co.uk';
  /**
   * Sets the From name of the message.
   * @var string
   */
  public $FromName          = 'Name';
  /**
   * Sets the Sender email (Return-Path) of the message.  If not empty,
   * will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
   * @var string
   */
  public $Sender            = 'noreply@domain.co.uk';
  /**
   * Sets the Subject of the message.
   * @var string
   */
  public $Subject           = '';
  /**
   * Sets the Body of the message.  This can be either an HTML or text body.
   * If HTML then run IsHTML(true).
   * @var string
   */
  public $Body              = '';
  /**
   * Sets the text-only body of the message.  This automatically sets the
   * email to multipart/alternative.  This body can be read by mail
   * clients that do not have HTML email capability such as mutt. Clients
   * that can read HTML will view the normal Body.
   * @var string
   */
  public $AltBody           = '';
  /**
   * Stores the complete compiled MIME message body.
   * @var string
   * @access protected
   */
  protected $MIMEBody       = '';
  /**
   * Stores the complete compiled MIME message headers.
   * @var string
   * @access protected
   */
  protected $MIMEHeader     = '';
  /**
   * Stores the complete sent MIME message (Body and Headers)
   * @var string
   * @access protected
  */
  protected $SentMIMEMessage     = '';
  /**
   * Sets word wrapping on the body of the message to a given number of
   * characters.
   * @var int
   */
  public $WordWrap          = 0;
  /**
   * Method to send mail: ("mail", "sendmail", or "smtp").
   * @var string
   */
  public $Mailer            = 'smtp';
  /**
   * Sets the path of the sendmail program.
   * @var string
   */
  public $Sendmail          = '/usr/sbin/sendmail';
  /**
   * Path to PHPMailer plugins.  Useful if the SMTP class
   * is in a different directory than the PHP include path.
   * @var string
   */
  public $PluginDir         = '';
  /**
   * Sets the email address that a reading confirmation will be sent.
   * @var string
   */
  public $ConfirmReadingTo  = '';
  /**
   * Sets the hostname to use in Message-Id and Received headers
   * and as default HELO string. If empty, the value returned
   * by SERVER_NAME is used or 'localhost.localdomain'.
   * @var string
   */
  public $Hostname          = 'mail.domain.co.uk';
  /**
   * Sets the message ID to be used in the Message-Id header.
   * If empty, a unique id will be generated.
   * @var string
   */
  public $MessageID         = '';

直到最近,一切都运转良好。

我尝试对脚本进行各种更改,但似乎无法解决此错误。

我得到的错误是:

SMTP -> FROM SERVER:250 OK 
SMTP -> get_lines(): $data was "" 
SMTP -> get_lines(): $str is "501 <>: missing or malformed local part " 
SMTP -> get_lines(): $data is "501 <>: missing or malformed local part " 
SMTP -> FROM SERVER:501 <>: missing or malformed local part 
SMTP -> ERROR: RCPT not accepted from server: 501 <>: missing or malformed local part 
SMTP Error: The following recipients failed: SMTP Error: The following recipients failed:
SMTP server error: <>: missing or malformed local part

1 个答案:

答案 0 :(得分:0)

您正在使用非常老旧且有错误的PHPMailer版本。 Update to the latest version,并根据其附带的示例编写代码。