$message = __('Someone requested that the password be reset for the following account:') . "\r\n\r\n";
$message .= network_home_url( '/' ) . "\r\n\r\n";
$message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
$message .= __('If this was a mistake, just ignore this email and nothing will happen.') . "\r\n\r\n";
$message .= __('To reset your password, visit the following address:') . "\r\n\r\n";
$message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user_login), 'login') . ">\r\n";
我收到的电子邮件没有wp-login.php
有人要求重置密码以进行以下操作 帐户:
用户名:test12
如果这是一个错误,请忽略此电子邮件,不会发生任何事情。
要重置密码,请访问以下地址:
<http://localhost.com?action=rp&key=$P$Btka6BPNxTtMA2ohCF4bLMwaQ0pXHc/&login=test12>
我调试并发现系统正在检查链接是否有wp-login.php然后从链接中删除此文件名并发送邮件。有没有我们可以检查的文件?
答案 0 :(得分:0)
我遇到了同样的问题。对我来说,解决方案是将邮件解析为html。我将它添加到函数中,现在可以正常工作。
function html_laiskai(){
return "text/html";
}
add_filter( 'wp_mail_content_type','html_laiskai' );
add_filter( 'wp_mail', 'html_email_encode_body' );
function html_email_encode_body( $mail ) {
$mail['message'] = str_replace("\r\n", "<br />", $mail['message']);
return $mail;
}
第一个功能将所有电子邮件的标题更改为text/html
。
第二个函数更改了\r\n
个<br />
换行符。