Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/289.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 使用WordPress通过SMTP发送邮件?_Php_Wordpress_Email_Ssl - Fatal编程技术网

Php 使用WordPress通过SMTP发送邮件?

Php 使用WordPress通过SMTP发送邮件?,php,wordpress,email,ssl,Php,Wordpress,Email,Ssl,首先,我想说的是,我不太了解smtp电子邮件和php_邮件的事情。我正在使用电子邮件插件来使用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"]=>

首先,我想说的是,我不太了解smtp电子邮件和php_邮件的事情。我正在使用电子邮件插件来使用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)
}
已发送测试消息
结果是:
布尔(真)
完整调试输出如下所示:
对象(PHPMailer)#4817(65){
[“优先级”]=>
int(3)
[“字符集”]=>
串(5)“UTF-8”
[“ContentType”]=>
字符串(10)“文本/普通”
[“编码”]=>
字符串(4)“8位”
[“错误信息”]=>
字符串(0)”
[“从”]=>
字符串(24)”destektazedizi@gmail.com"
[“FromName”]=>
字符串(16)“Taze-Dizi-Destek”
[“发件人”]=>
字符串(0)”
[“返回路径”]=>
字符串(0)”
[“主题”]=>
字符串(47)“WP邮件SMTP:测试邮件发送至farukest90@gmail.com"
[“正文”]=>
字符串(68)“这是由WP Mail SMTP WordPress插件生成的测试电子邮件。”
[“AltBody”]=>
字符串(0)”
[“MIMEBody”:受保护]=>
字符串(69)“这是由WP Mail SMTP WordPress插件生成的测试电子邮件。
"
[“MIMEHeader”:受保护]=>
字符串(377)“日期:2014年5月1日星期四16:35:44+0000
返回路径:destektazedizi@gmail.com
发件人:Taze Dizi Destek
消息ID:
X优先级:3
X-Mailer:PHPMailer 5.2.4(http://code.google.com/a/apache-extras.org/p/phpmailer/)
MIME版本:1.0
内容传输编码:8比特
内容类型:文本/普通;字符集=UTF-8
"
[“邮件头”:受保护]=>
字符串(82)“至:farukest90@gmail.com
主题:WP Mail SMTP:测试邮件发送至farukest90@gmail.com
"    
[“文字包装”]=>
int(0)
[“邮件”]=>
字符串(4)“邮件”
[“发送邮件”]=>
字符串(18)“/usr/sbin/sendmail”
[“UseSendmailOptions”]=>
布尔(真)
[“PluginDir”]=>
字符串(0)”
[“确认阅读到”]=>
字符串(0)”
[“主机名”]=>
字符串(0)”
[“MessageID”]=>
字符串(0)”
[“MessageDate”]=>
字符串(0)”
[“主机”]=>
字符串(9)“本地主机”
[“端口”]=>
国际(25)
[“Helo”]=>
字符串(0)”
[“SMTPSecure”]=>
字符串(3)“ssl”
[“SMTPAuth”]=>
布尔(假)
[“用户名”]=>
字符串(0)”
[“密码”]=>
字符串(0)”
[“AuthType”]=>
字符串(0)”
[“领域”]=>
字符串(0)”
[“工作站”]=>
字符串(0)”
[“超时”]=>
国际(10)
[“SMTPDebug”]=>
布尔(真)
[“调试输出”]=>
字符串(4)“echo”
[“SMTPKeepAlive”]=>
布尔(假)
[“SingleTo”]=>
布尔(假)
[“SingleToArray”]=>
数组(0){
}
[“乐”]=>
字符串(1)”
"
[“DKIM_选择器”]=>
字符串(0)”
[“DKIM_身份”]=>
字符串(0)”
[“DKIM_密码短语”]=>
字符串(0)”
[“DKIM_域”]=>
字符串(0)”
[“DKIM_private”]=>
字符串(0)”
[“操作功能”]=>
字符串(0)”
[“版本”]=>
串(5)“5.2.4”
[“XMailer”]=>
字符串(0)”
[“smtp”:受保护]=>
无效的
[“至”:受保护]=>
阵列(1){
[0]=>
阵列(2){
[0]=>
字符串(20)”farukest90@gmail.com"
[1]=>
字符串(0)”
}
}
[“抄送”:受保护]=>
数组(0){
}
[“密件抄送”:受保护]=>
数组(0){
}
[“ReplyTo”:受保护]=>
数组(0){
}
[“所有收件人”:受保护]=>
阵列(1){
["farukest90@gmail.com"]=>
布尔(真)
}
[“附件”:受保护]=>
数组(0){
}
[“CustomHeader”:受保护]=>
数组(0){
}
[“消息类型”:受保护]=>
字符串(5)“普通”
[“边界”:受保护]=>
阵列(3){
[1]=>
串(35)“B1590991A14F48CCFF103EBAEF7F3A0AC8”
[2]=>
串(35)“B2590991A14F48CCFF103EBAEF7F3A0AC8”
[3]=>
串(35)“b3_590991a14f48ccff103ebaef7f3a0ac8”
}
[“语言”:受保护]=>
数组(0){
}
[“错误计数”:受保护]=>
int(0)
[“签名证书文件”:受保护]=>
字符串(0)”
[“签名密钥文件”:受保护]=>
字符串(0)”
[“签名密钥通过”:受保护]=>
字符串(0)”
[“例外”:受保护]=>
布尔(真)
}
我的配置:

来自邮件:
mymail@gmail.com

来自名称:
站点名称

使用:
通过SMTP发送所有WordPress电子邮件

Smtp主机:
Smtp.gmail.com

Smtp端口:
465

加密:
使用SSL加密

作者:
使用SMTP身份验证

用户名:
mymail@gmail.com

密码:
mymail@gmail的密码


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

也许你可以用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-卸载所有smtp插件
2-安装以下插件:电子邮件返回路径标题修复

可能与我没有编写用于发送邮件的代码重复。我正在使用插件。如果有设置(代码)需要添加,我可以,但问题是不同的。请仔细比较问题。对不起,欢迎使用堆栈溢出。这是一个关于编程问题的网站。如果你有一个插件问题,你应该在什么是问题?看起来电子邮件正在发送。你检查过你的垃圾邮件/垃圾邮件文件夹吗?这不是一个插件问题。我搜索我的问题的来源,我说:我不太了解电子邮件smtp php邮件的事情。如果有人看到我的问题并对我说“你必须这样做”,那么我可以搜索并添加代码。如果你不想帮忙,请不要写信。Chris Herbert,是的,它似乎在工作,但我检查了垃圾邮件和垃圾邮件文件夹,但没有电子邮件。我使用的是nginx,我需要在php.ini中添加代码吗?使用注释。这不是一个n答案