1

所以这是我第一次在这里问。我一直在尝试为我公司的 Testlink 启用任何 SMTP。但是,我无法弄清楚为什么我从 8 小时前就无法让它工作。我的办公时间一直在试图解决这个问题并在那里和这里搜索,但遗憾的是,似乎没有一个解决方案适合我。如果有人可以请修改我的代码,我会很高兴得到你的帮助。

错误主要是关于:

SMTP -> FROM SERVER:
SMTP -> FROM SERVER:
SMTP -> ERROR: EHLO not accepted from server:
SMTP -> FROM SERVER:
SMTP -> ERROR: HELO not accepted from server:
SMTP -> ERROR: AUTH not accepted from server:
SMTP -> NOTICE: EOF caught while checking if connectedSMTP Error: Could not authenticate. PROBLEMS SENDING MAIL TO: sapurabugzilla@gmail.com
Mailer Error: SMTP Error: Could not authenticate.

并且大多数时候它显示它无法加载 TLS 字符串。

这是我的 config.inc.php 文件:

/* [SMTP] */

/**
 * @var string SMTP server name or IP address ("localhost" should work in the most cases)
 * Configure using custom_config.inc.php
 * @uses lib/functions/email_api.php
 */


// SMTP server Configuration ("localhost" is enough in the most cases)
$g_smtp_host        = 'smtp.gmail.com:465';  # SMTP server MUST BE configured  

# Configure using custom_config.inc.php
$g_tl_admin_email     = 'sapuratestlink@gmail.com'; # for problem/error notification
$g_from_email         = 'sapuratestlink@gmail.com';  # email sender
$g_return_path_email  = 'sapuratestlink@gmail.com';

# Urgent = 1, Not Urgent = 5, Disable = 0
$g_mail_priority = 5;   

/**
 * Taken from mantis for phpmailer config
 * select the method to mail by:
 * PHPMAILER_METHOD_MAIL - mail()
 * PHPMAILER_METHOD_SENDMAIL - sendmail
 * PHPMAILER_METHOD_SMTP - SMTP
 */
$g_phpMailer_method = PHPMAILER_METHOD_SMTP;

/** Configure only if SMTP server requires authentication */
$g_smtp_username    = 'sapuratestlink@gmail.com';  # user
$g_smtp_password    = 'xxxxxxxx';  # password

/**
 * This control the connection mode to SMTP server. 
 * Can be '', 'ssl','tls'
 * @global string $g_smtp_connection_mode
 */
$g_smtp_connection_mode = '';

/**
 * The smtp port to use.  The typical SMTP ports are 25 and 587.  The port to use
 * will depend on the SMTP server configuration and hence others may be used.
 * @global int $g_smtp_port
 */
$g_smtp_port = 465;  

class.phpmailer.php 文件:

/**
   * 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            = 'sapuratestlink@gmail.com';

  /**
   * 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           = '';

  /**
   * 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  = 'sapuratestlink@gmail.com';

  /**
   * 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          = '';

  /**
   * Sets the message ID to be used in the Message-Id header.
   * If empty, a unique id will be generated.
   * @var string
   */
  public $MessageID         = '';

  /////////////////////////////////////////////////
  // PROPERTIES FOR SMTP
  /////////////////////////////////////////////////

  /**
   * Sets the SMTP hosts.  All hosts must be separated by a
   * semicolon.  You can also specify a different port
   * for each host by using this format: [hostname:port]
   * (e.g. "smtp1.example.com:25;smtp2.example.com").
   * Hosts will be tried in order.
   * @var string
   */
  public $Host          = 'smtp.gmail.com:465';

  /**
   * Sets the default SMTP server port.
   * @var int
   */
  public $Port          = 465;

  /**
   * Sets the SMTP HELO of the message (Default is $Hostname).
   * @var string
   */
  public $Helo          = 'Hi from Admin Testlink';

  /**
   * Sets connection prefix.
   * Options are "", "ssl" or "tls"
   * @var string
   */
  // public $SMTPSecure    = 'tls';

  /**
   * Sets SMTP authentication. Utilizes the Username and Password variables.
   * @var bool
   */
  public $SMTPAuth      = true;

  /**
   * Sets SMTP username.
   * @var string
   */
  public $Username      = 'sapuratestlink@gmail.com';

  /**
   * Sets SMTP password.
   * @var string
   */
  public $Password      = 'xxxxx';

  /**
   * Sets the SMTP server timeout in seconds.
   * This function will not work with the win32 version.
   * @var int
   */
  public $Timeout       = 10;

  /**
   * Sets SMTP class debugging on or off.
   * @var bool
   */
  public $SMTPDebug     = true;

  /**

如果你有空,请帮助我!谢谢你。

4

2 回答 2

2

更改 config.inc.php 文件中的以下行

从 :

$g_smtp_host        = 'smtp.gmail.com:465';

至 :

$g_smtp_host        = 'smtp.gmail.com';

并尝试。

我在评论您的问题时的 stackoverflow 声誉较低,因此仅将其发布为答案。

于 2015-08-26T09:47:36.537 回答
0

删除端口

$g_smtp_host = 'smtp.gmail.com:465';

喜欢

$g_smtp_host = 'smtp.gmail.com';

并在下面添加端口为

$g_smtp_port = 465;

并选择连接模式为 ssl

$g_smtp_connection_mode = 'ssl';
于 2018-11-28T17:45:44.293 回答