解决wordpress mu 收不到邮件问题
今天有个朋友说如何才能解决wordpress mu收不到邮件的问题呢?
我记得wordpress mu默认发送邮件是没有问题的,可是有些邮件服务器却无法收到,比如hotmail,估计是由于采用的Linux默认的sendmail,没有经过认证,所以被邮件服务器给丢弃了
那应该如何解决呢?
我以前写过一篇文章《让wordpress mu新用户注册后的密码明文显示,取消邮件通知》
上面有无法接收邮件时,直接在注册完成后显示用户和密码的方法
可是如果一定要使用邮件怎么办?
既然采用Linux内部的有时候收不到,那能不能采用外部的邮件系统呢?
仔细看了源码,发现wordpress使用的是phpmailer来进行邮件的发送
这样的话使用外部的邮件系统来发送应该问题不大,测试后采用如下步骤解决之:^__^
如果你觉得下面的东东比较麻烦,你可以点这里直接下载修改后的文章, 下载后解压至 /wp-includes/ 目录下, 记得要修改 mail-inc.php 文件中的邮件信息哦.
1)在 /wp-includes/ 新建 mail-inc.php 文件(这个文件主要是设置 SMTP 服务器的信息), 代码如下:
require("class-phpmailer.php");
class MyMailer extends PHPMailer {
// Set default variables for all new objects
var $Mailer = "smtp"; // Alternative to IsSMTP()
var $CharSet = "utf-8";
var $From = "你的邮件地址";
var $FromName = "name,你想起什么名字都可以";
var $Host = "smtp服务器地址";
var $Port = 25; //smtp server port
var $SMTPAuth = true;
var $Username = "你邮件的帐号";
var $Password = "你邮件的密码";
var $WordWrap = 75;
}
?>
2)打开 /wp-includes/pluggable.php, 查找 function wp_mail($to, $subject, $message, $headers = ”) { global $phpmailer;
在 global $phpmail; 其前面添加如下代码:
require(“mail-inc.php”);
$mail = new MyMailer;
$mail->AddAddress($to);
$mail->Subject = $subject;
$mail->Body = $message;
return $mail->Send();
3) 继续在此文件中查找 wp_new_user_notification 函数, 把:
wp_mail($user_email, sprintf(__(‘[%s] Your username and password’), get_settings(‘blogname’)), $message);
// 修改为:
@wp_mail($user_email, sprintf(__(‘[%s] Your username and password’), get_settings(‘blogname’)), $message);
好像就是在前面加上一个@而已.
4) 在文结尾(?>)前添加如下代码:
if ( !function_exists(‘wp_mail_attachment’) ) :
function wp_mail_attachment($to, $subject, $message, $string, $filename, $encoding, $type) {
require(“mail.inc.php”);
$mail = new MyMailer;
$mail->AddAddress($to);
$mail->Subject = $subject;
$mail->Body = $message;
$mail->AddStringAttachment($string, $filename, $encoding, $type);
return $mail->Send();
}
endif;
如有疑问,欢迎后面留言 ^_^
Fatal error: Cannot redeclare class EkinMailer in /home1/eigzerbl/public_html/wp-includes/mail-inc.php on line 14我的激活时候出了这个,请问是怎么了.我的mu是2.6
您看一下pluggable.php文件的wp_mail函数中是否有这两行:
require(“mail-inc.php”);
$mail = new EkinMailer;
我的情况也一样。Fatal error: Cannot redeclare class EkinMailer in /home1/eigzerbl/public_html/wp-includes/mail-inc.php on line 14
刷新这个页面又正常了,估计是引用类的时候有点问题?
我是严格按照博主说明的操作。
另外还有一个问题。按照你所的改了以后,注册后会发一份邮件到你的邮箱(这正常),然后输入激活码,系统会提示给你的邮箱发送了密码(这份邮件收不到),只能点忘记密码(这时候又能收到系统发给你的忘记密码的邮件)。
我装的是2.6.2版的MU
还装了buddypress
请问该如何修改啊
我照你这样改的有错误
是说class-smtp.php这个文件出错
不错
其实,使用本机的SendMail发邮件,非常简单,当然,加入你的机器里装了SendMail的话。
需要在/etc/mail/access里面,加入:
Connect:192.168.1.100 RELAY
这里,假设你的本机IP是192.168.1.100的话,如果不是请修改。
注意:千万别去管什么防火墙设置
然后——你随便,发就是了 :)
In a very entire world involving knock-offs, making sure that your current chanel purses can be legitimate along with shielded is still a necessary worry while getting as well as offering your handbag.
Knockoff chanel perfume have larger pockets than genuine Chanel handbags.
Check the inside flap of the coco chanel, which should be smooth and wrinkle free.
Your chanel purses outlet range capabilities distinctive high-quality luggage as their design and style, create along with submitting are generally firmly manipulated.
On an authentic chanel perfumes on sale the lettering is only located on the lower half of the interior flap, in front of the interior open pocket or just above the open pocket.
A number of with all the louis vuitton get lasted for many years during a period and still have submit to your center heirloom receiving handed down decrease through the lone years to an alternative.
Unlike low quality louis vuitton sneakers, it may be cheaper but you have to change it every now and then.
The materials used are both practical and economical for the louis vuitton shoes user.
If you own lv shoes, you become one of the women who know the fashion world.
You’ll be able to think your unusal perfume involving leather-based lv outlet store 2012 and also the leather-based can be reasonably delicate.