使用Gmail SMTP连接Testlink

时间:2015-04-06 09:57:08

标签: email smtp gmail testlink

所以这是我第一次问这里。我一直在尝试为我公司的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;

  /**




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

2 个答案:

答案 0 :(得分:2)

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

来自:

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

致:

$g_smtp_host        = 'smtp.gmail.com';

然后试试。

我有较少的stackoverflow声誉来评论您的问题,因此只将其作为答案发布。

答案 1 :(得分:0)

删除端口
$g_smtp_host = 'smtp.gmail.com:465';

喜欢

$g_smtp_host = 'smtp.gmail.com';

并在下面添加端口

$g_smtp_port = 465;

,然后将连接模式选择为ssl

$g_smtp_connection_mode = 'ssl';
相关问题