2012年6月2日土曜日

WordpressでsmtpサーバをGmailに設定する

wp-includes/class-phpmailer.phpの以下のように修正
/**
   * Sets the From email address for the message.
   * @var string
   */
  var $From              = 'test@test.com';

    /**
   * Method to send mail: ("mail", "sendmail", or "smtp").
   * @var string
   */
  var $Mailer            = '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
   */
  var $Host        = 'smtp.gmail.com';

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

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

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

  /**
   * Sets SMTP username.
   * @var string
   */
  var $Username     = 'test@test.com';

  /**
   * Sets SMTP password.
   * @var string
   */
  var $Password     = 'testtest';
wp-includes/pluggable.phpを以下のように修正
// Set to use PHP's mail()
//$phpmailer->IsMail();
$phpmailer->IsSMTP(true);