wordpress留言板中怎么添加姓名邮件如图,怎么添加姓名邮件
展开全部 有以下3种方法来实现“免插件仅代码实现WordPress评论回复邮件提醒”,都是把代码加到主题里的functions.php中的最后一个 ?> 即可。
第一种:所有回复都发邮件通知使用前,请确定你的主机是否支持 mail() 函数。
/* comment_mail_notify v1.0 by willin kan. (所有回复都发邮件) */function comment_mail_notify($comment_id) { $comment = get_comment($comment_id); $parent_id = $comment->comment_parent ? $comment->comment_parent : ''; $spam_confirmed = $comment->comment_approved; if (($parent_id != '') && ($spam_confirmed != 'spam')) { $wp_email = 'no-reply@' . preg_replace('#^www.#', '', strtolower($_SERVER['SERVER_NAME'])); //e-mail 发出点, no-reply 可改为可用的 e-mail. $to = trim(get_comment($parent_id)->comment_author_email); $subject = '您在 [' . get_option("blogname") . '] 的留言有了回复'; $message = ' ' . trim(get_comment($parent_id)->comment_author) . ', 您好! 您曾在《' . get_the_title($comment->comment_post_ID) . '》的留言:' . trim(get_comment($parent_id)->comment_content) . ' ' . trim($comment->comment_author) . ' 给您的回复:' . trim($comment->comment_content) . ' 您可以点击 查看回复完整内容 欢迎再度光临 ' . get_option('blogname') . ' (此邮件由系统自动发送,请勿回复.) '; $from = "From: "" . get_option('blogname') . "" "; $headers = "$fromnContent-Type: text/html; charset=" . get_option('blog_charset') . "n"; wp_mail( $to, $subject, $message, $headers ); //echo 'mail to ', $to, ' ' , $subject, $message; // for testing }}add_action('comment_post', 'comment_mail_notify');// -- END - 第二种:让访客自己选择是否邮件通知在评论框下方显示一个勾选框,让评论人自己决定是否接收邮件通知。
不过要注意的是,具体的#comment_mail_notify 需要你自己定义css以符合你的主题样式。
function comment_mail_notify($comment_id) { $admin_notify = '1'; // admin 要不要收回复通知 ( '1'=要 ; '0'=不要 ) $admin_email = get_bloginfo ('admin_email'); // $admin_email 可改为你指定的 e-mail. $comment = get_comment($comment_id); $comment_author_email = trim($comment->comment_author_email); $parent_id = $comment->comment_parent ? $comment->comment_parent : ''; global $wpdb; if ($wpdb->query("Describe {$wpdb->comments} comment_mail_notify") == '') $wpdb->query("ALTER TABLE {$wpdb->comments} ADD COLUMN comment_mail_notify TINYINT NOT NULL DEFAULT 0;"); if (($comment_author_email != $admin_email && isset($_POST['comment_mail_notify'])) || ($comment_author_email == $admin_email && $admin_notify == '1')) $wpdb->query("UPDATE {$wpdb->comments} SET comment_mail_notify='1' WHERE comment_ID='$comment_id'"); $notify = $parent_id ? get_comment($parent_id)->comment_mail_notify : '0'; $spam_confirmed = $comment->comment_approved; if ($parent_id != '' && $spam_confirmed != 'spam' && $notify == '1') { $wp_email = 'no-reply@' . preg_replace('#^www.#', '', strtolower($_SERVER['SERVER_NAME'])); // e-mail 发出点, no-reply 可改为可用的 e-mail. $to = trim(get_comment($parent_id)->comment_author_email); $subject = '您在 [' . get_option("blogname") . '] 的留言有了回复'; $message = ' ' . trim(get_comment($parent_id)->comment_author) . ', 您好! 您曾在《' . get_the_title($comment->comment_post_ID) . '》的留言:' . trim(get_comment($parent_id)->comment_content) . ' ' . trim($comment->comment_author) . ' 给您的回复:' . trim($comment->comment_content) . ' 您可以点击查看回复的完整内容 还要再度光临 ' . get_option('blogname') . ' (此邮件由系统自动发送,请勿回复.) '; $from = "From: "" . get_option('blogname') . "" "; $headers = "$fromnContent-Type: text/html; charset=" . get_option('blog_charset') . "n"; wp_mail( $to, $subject, $message, $headers ); //echo 'mail to ', $to, ' ' , $subject, $message; // for testing }}add_action('comment_post', 'comment_mail_...
wordpress邮件发送成功为什么没收到邮件
第一:服务器不支持,需要找空间商开启函数第二:WordPress程序本来发邮件机制就有问题,可以修改它的代码;复制以下代码,添加到主题文件functions.php并修改代码中的参数。
//使用smtp发邮件 02 add_action('phpmailer_init', 'mail_smtp'); 03 function mail_smtp( $phpmailer ) { 04 $phpmailer->IsSMTP(); 05 $phpmailer->SMTPAuth = true;//启用SMTPAuth服务 06 $phpmailer->Port = 465;//MTP邮件发送端口,这个和下面的对应,如果这里填写25,则下面为空白 07 $phpmailer->SMTPSecure = "ssl";//是否验证 ssl,这个和上面的对应,如果不填写,则上面的端口须为25 08 $phpmailer->Host = "smtp.gmail.com";//邮箱的SMTP服务器地址,如果是QQ的则为:smtp.exmail.qq.com 09 $phpmailer->Username = "admin@henghengzhu.com";//你的邮箱地址 10 $phpmailer->Password = "******";//你的邮箱登陆密码 11 }
怎么关闭wordpress新用户注册邮件通知?
关闭wordpress新用户注册邮件通知方法:打开wp-includes/pluggable.php 文件搜索定位到:代码如下 wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);注释之,保存即可。
代码如下 //wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);上面这个方法是直接去掉邮件通知功能
有了QQ企业邮箱之后,要怎么设置才能让它作为网站(wordpress)...
后台—设置—常规—E-mail Address 填你的新申请的 用户名@域名另外就是邮件服务器插件的设置,我用的这个插件:Configure SMTP设置方法很简单,填的信息也是你新申请的邮箱 下面有测试是否成功的选项,设置完成之后可以试一下。
祝你成功!
如何解决Godaddy主机上WordPress不能发邮件呢?
在刚接触互联网的时候,使用过一次Godaddy主机,当时只熟悉中文Cpenal控制面板,使用了一天,退款了! 前段时间看到美国主机极客收集的Godaddy优惠码,又买了一年Deluxe,还搞了个SSL和独立IP玩玩(Godaddy买SSL送独立IP),到今天才发现,Godaddy不支持WordPress邮件功能,在Godaddy主机上完全没用了! 尝试安装Mail To Commenter等插件都不行,以为是邮箱有问题,又换了Gmail、Live、16 3、QQ全部失败。
只好去WordPress E文求助,最后终于找到了解决方案。
下面是笔者翻译过来的 1、安装WP-Mail-SMTP 2、填写Email知道,名字等参数,STMP填写“relay-hosting.secureserver.net” 端口填写25,下面的用户名、密码无需填写。
3、完美解决
转载请注明出处51数据库 » wordpress wp-mail-sm