使用WordPress通过SMTP发送邮件?

时间:2014-05-01 16:53:25

标签: php wordpress email ssl

首先,我想说我不太了解smtp电子邮件php_mail的事情。我使用电子邮件插件来使用smtp邮件。我配置了我的smtp选项,然后用测试功能测试了电子邮件。

有日志:

Test Message Sent
The result was:
bool(true)
The full debugging output is shown below:
object(PHPMailer)#4817 (65) {
  ["Priority"]=>
  int(3)
  ["CharSet"]=>
  string(5) "UTF-8"
  ["ContentType"]=>
  string(10) "text/plain"
  ["Encoding"]=>
  string(4) "8bit"
  ["ErrorInfo"]=>
  string(0) ""
  ["From"]=>
  string(24) "destektazedizi@gmail.com"
  ["FromName"]=>
  string(16) "Taze Dizi Destek"
  ["Sender"]=>
  string(0) ""
  ["ReturnPath"]=>
  string(0) ""
  ["Subject"]=>
  string(47) "WP Mail SMTP: Test mail to farukest90@gmail.com"
  ["Body"]=>
  string(68) "This is a test email generated by the WP Mail SMTP WordPress plugin."
  ["AltBody"]=>
  string(0) ""
  ["MIMEBody":protected]=>
 string(69) "This is a test email generated by the WP Mail SMTP WordPress plugin.
"
  ["MIMEHeader":protected]=>
  string(377) "Date: Thu, 1 May 2014 16:35:44 +0000
Return-Path: destektazedizi@gmail.com
From: Taze Dizi Destek 
Message-ID: <590991a14f48ccff103ebaef7f3a0ac8@www.tazedizi.com>
X-Priority: 3
X-Mailer: PHPMailer 5.2.4 (http://code.google.com/a/apache-extras.org/p/phpmailer/)
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=UTF-8
"
  ["mailHeader":protected]=>
  string(82) "To: farukest90@gmail.com
    Subject: WP Mail SMTP: Test mail to farukest90@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(3) "ssl"
  ["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) {
  }
  ["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) ""
  ["Version"]=>
  string(5) "5.2.4"
  ["XMailer"]=>
  string(0) ""
  ["smtp":protected]=>
  NULL
  ["to":protected]=>
  array(1) {
    [0]=>
    array(2) {
      [0]=>
      string(20) "farukest90@gmail.com"
      [1]=>
      string(0) ""
    }
  }
  ["cc":protected]=>
  array(0) {
  }
  ["bcc":protected]=>
  array(0) {
  }
  ["ReplyTo":protected]=>
  array(0) {
  }
  ["all_recipients":protected]=>
  array(1) {
    ["farukest90@gmail.com"]=>
    bool(true)
  }
  ["attachment":protected]=>
      array(0) {
  }
  ["CustomHeader":protected]=>
  array(0) {
  }
  ["message_type":protected]=>
  string(5) "plain"
  ["boundary":protected]=>
  array(3) {
    [1]=>
    string(35) "b1_590991a14f48ccff103ebaef7f3a0ac8"
    [2]=>
    string(35) "b2_590991a14f48ccff103ebaef7f3a0ac8"
    [3]=>
    string(35) "b3_590991a14f48ccff103ebaef7f3a0ac8"
  }
  ["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)
}

我的配置:

Froma Mail: mymail@gmail.com

来自姓名: Site Name

使用: Send all WordPress emails via SMTP

Smtp主持人: smtp.gmail.com

Smtp端口: 465

加密: USE SSL Encryption

AUTHENT。 : Use SMTP authentication

用户名: mymail@gmail.com

密码: mymail@gmail's password

我在哪里做错了。希望你能帮帮我。

2 个答案:

答案 0 :(得分:6)

也许不是使用你的插件,你可以使用PHP。

将此添加到你的functions.php:

add_action( 'phpmailer_init', 'my_phpmailer_init' );
function my_phpmailer_init( PHPMailer $phpmailer ) {
    $phpmailer->Host = 'smtp.yourSMTPhost.net';
    $phpmailer->Port = 465; // could be different
    $phpmailer->Username = 'YOURUSERNAME'; // if required
    $phpmailer->Password = 'YOURPASSWORD'; // if required
    $phpmailer->SMTPAuth = true; // if required
    $phpmailer->SMTPSecure = 'ssl'; // enable if required, 'tls' is another possible value
    $phpmailer->IsSMTP();
}

答案 1 :(得分:-1)

1-卸载所有smtp插件 2-安装以下插件:Email Return-Path Header Fix