如何在主题我的登录插件中发送链接

时间:2015-04-09 06:58:42

标签: wordpress

我在wordpress中使用了主题我的登录插件。我想发送重置密码链接邮件。所以写了这样的代码:

    $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";
    $message1 = "<a href='" . site_url() . "wp-login.php?action=rp&key=$key&login=".  rawurlencode( $user_login ) . "'>" . site_url() . "wp-login.php?action=rp&key=$key&login=".  rawurlencode( $user_login ). "</a>" ;

    $message .= $message1;

但是我收到了文字而不是链接。那么我该怎么做才能解决这个问题?

1 个答案:

答案 0 :(得分:0)

我已经解决了。我刚刚定义了一个这样的变量

    $headers = 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

并将此变量添加到wp_mail()函数中。所以它解决了。 谢谢。