wordpress建设博客或电商网站之四:解决发送邮件和用户注册的BUG

来源:互联网 发布:战地2网络对战平台 编辑:程序博客网 时间:2024/05/01 09:29

 wordpress建设博客或电商网站之四

解决发送邮件和用户注册的BUG


1 发送邮件

我的电商网站pepstack.com用QQ的SMTP服务发送邮件,因此需要使用一个插件:Configure SMTP。管理员登陆站点,进入管理员界面。插件->安装插件:Configure SMTP,设置如下:

end e-mail via GMail? 
Clicking this will override many of the settings defined below. You will need to input your GMail username and password below.SMTP host 
If "localhost" doesn't work for you, check with your host for the SMTP hostname.SMTP port 
This is generally 25.Secure connection prefix
Sets connection prefix for secure connections (prefix method must be supported by your PHP install and your SMTP host)Use SMTPAuth? 
If checked, you must provide the SMTP username and password belowSMTP usernameSMTP passwordWordwrap length 
Sets word wrapping on the body of the message to a given number of characters.Enable debugging? 
Only check this if you are experiencing problems and would like more error reporting to occur. Uncheck this once you have finished debugging.Sender e-mail 
Sets the From e-mail address for all outgoing messages. Leave blank to use the WordPress default. This value will be used even if you don't enable SMTP. NOTE: This may not take effect depending on your mail server and settings, especially if using SMTPAuth (such as for GMail).Sender name 
Sets the From name for all outgoing messages. Leave blank to use the WordPress default. This value will be used even if you don't enable SMTP. 

其中STMP password使用的是QQ的SMTP授权码而不是我登陆QQ的口令。master@pepstack.com是我的QQ邮箱设置为域名邮箱。用户可以直接使用自己的QQ邮箱(打开POP3,SMTP等服务)。这样一个可以发送邮件的网站就好了。


2 激活注册邮件BUG

然而我在pepstack.com新注册的用户(用我另外的QQ号)时,却无法激活注册邮件。错误类似:

WordPress 密码重置提示 您的密码重设链接无效

http://blog.csdn.net/h1217/article/details/53422835


解决办法是修改2个文件:

/opt/wordpress/wp-login.php

/opt/wordpress/wp-includes/pluggable.php


1) /opt/wordpress/wp-login.php: 约332行

原代码:

$message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n";

修正后:

        $message .= network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login');

2) /opt/wordpress/wp-includes/pluggable.php: 约1791行

原代码:


        $message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login') . ">\r\n\r\n";

        $message .= wp_login_url() . "\r\n";


修正后:

        $message .= network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login');        /*        $message .= wp_login_url() . "\r\n";        */


然后重启服务:

$ sudo  service apache2 reload


#### $ sudo  service apache2 stop

#### $ sudo  service apache2 start

#### $ sudo  service apache2 restart





2 0
原创粉丝点击