免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 7282 | 回复: 11
打印 上一主题 下一主题

[Mail] postfix可以在outlook里可以正常收发,但用php发送却报SMTP认证错误 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-12-31 14:14 |只看该作者 |倒序浏览
30可用积分
本人是这方面的新手,近日在公司里搭了个邮局
MTA用的是postfix  ,pop3用的是dovecot,并安装了cyrus-sasl2


  1. [root@mail PHPMailer_v5.1]# postconf -m
  2. btree
  3. cidr
  4. environ
  5. hash
  6. mysql
  7. nis
  8. proxy
  9. regexp
  10. static
  11. unix
复制代码


  1. [root@mail PHPMailer_v5.1]# postconf -a
  2. cyrus
  3. dovecot
复制代码


postfix配置,mail.abc.com为我的DNS域名

  1. [root@mail PHPMailer_v5.1]# postconf -n
  2. alias_database = $alias_maps
  3. alias_maps = hash:/etc/aliases
  4. broken_sasl_auth_clients = yes
  5. command_directory = /usr/sbin
  6. config_directory = /etc/postfix
  7. daemon_directory = /usr/libexec/postfix
  8. data_directory = /var/lib/postfix
  9. debug_peer_level = 2
  10. html_directory = no
  11. inet_interfaces = all
  12. mail_owner = postfix
  13. mailq_path = /usr/bin/mailq
  14. manpage_directory = /usr/local/man
  15. message_size_limit = 14336000
  16. mydestination = $myhostname, localhost.$mydomain, localhost
  17. mydomain = abc.com
  18. myhostname = mail
  19. mynetworks = 127.0.0.1/8
  20. mynetworks_style = subnet
  21. myorigin = $myhostname
  22. newaliases_path = /usr/bin/newaliases
  23. queue_directory = /var/spool/postfix
  24. readme_directory = no
  25. sample_directory = /etc/postfix
  26. sendmail_path = /usr/sbin/sendmail
  27. setgid_group = postdrop
  28. smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
  29. smtpd_sasl_auth_enable = yes
  30. smtpd_sasl_local_domain = $myhostname
  31. smtpd_sasl_security_options = noanonymous
  32. unknown_local_recipient_reject_code = 550
  33. virtual_alias_maps = mysql:/etc/postfix/mysql/mysql_virtual_alias_maps.cf
  34. virtual_gid_maps = static:12345
  35. virtual_mailbox_base = /data/mailbox
  36. virtual_mailbox_domains = mysql:/etc/postfix/mysql/mysql_virtual_domains_maps.cf
  37. virtual_mailbox_maps = mysql:/etc/postfix/mysql/mysql_virtual_mailbox_maps.cf
  38. virtual_transport = virtual
  39. virtual_uid_maps = static:12345
复制代码


在outlook中测试收发均正常,但是用PHPMailer_v5.1的smtp方式发却会报

  1. SMTP Error: Could not authenticate.
  2. Message could not be sent. <p>Mailer Error: SMTP Error: Could not authenticate.
复制代码

查看/var/log/maillog,发现有下列错误提示

  1. Dec 31 13:56:24 localhost postfix/master[26230]: warning: process /usr/libexec/postfix/smtpd pid 11389 killed by signal 11
  2. Dec 31 13:56:24 localhost postfix/master[26230]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling
复制代码


这个问题我已经搞了两三天了,在网上看了很多教程也不行,请高手帮帮忙


自己已经解决了

换成用用dovecot的sql认证smtp就可以了

不过还是感谢众位的热心回复,因为BZ最先回复,这分就给他了


[ 本帖最后由 00306 于 2010-1-4 14:11 编辑 ]

最佳答案

查看完整内容

在/etc/hosts中加入你的机器的iptelnet postfix 25号端口没有反映,110正确的密码却提示错误!(页 1) - Mail服务器 - 51CTO技术论坛_中国领先的IT技术社区 (31 December 2009) http://bbs.51cto.com/archiver/tid-454549.html

论坛徽章:
0
2 [报告]
发表于 2009-12-31 14:14 |只看该作者
在/etc/hosts中加入你的机器的ip
telnet postfix 25号端口没有反映,110正确的密码却提示错误!(页 1) - Mail服务器 - 51CTO技术论坛_中国领先的IT技术社区 (31 December 2009)
http://bbs.51cto.com/archiver/tid-454549.html

论坛徽章:
0
3 [报告]
发表于 2009-12-31 14:15 |只看该作者
自己先顶顶

论坛徽章:
0
4 [报告]
发表于 2009-12-31 14:18 |只看该作者

论坛徽章:
0
5 [报告]
发表于 2009-12-31 14:19 |只看该作者
原帖由 ziggler 于 2009-12-31 14:17 发表
在/etc/hosts中加入你的机器的ip
telnet postfix 25号端口没有反映,110正确的密码却提示错误!(页 1) - Mail服务器 - 51CTO技术论坛_中国领先的IT技术社区 (31 December 2009)
http://bbs.51cto.com/archiver ...


telnet mail.abc.com进行发送是正常的,pop3也能正常收,而且我在outlook里面发送和接收邮件都是成功的
现在可能是smtp这块配置有问题
我有在/etc/hosts中加入

  1. 111.111.111.111  mail.abc.com
复制代码

[ 本帖最后由 00306 于 2009-12-31 14:23 编辑 ]

论坛徽章:
0
6 [报告]
发表于 2009-12-31 14:21 |只看该作者
PHPMail我的配置是这样的

  1. <?php
  2. require("class.phpmailer.php");

  3. $mail = new PHPMailer();

  4. $mail->IsSMTP();                                      // set mailer to use SMTP
  5. $mail->Host = "mail.abc.com";  // specify main and backup server
  6. $mail->SMTPAuth = true;     // turn on SMTP authentication
  7. $mail->Username = "admin@mail.abc.com";  // SMTP username
  8. $mail->Password = "123456"; // SMTP password

  9. $mail->From = "admin@mail.abc.com";
  10. $mail->FromName = "Texas";
  11. $mail->AddAddress("lsm@mail.abc.com", "LSM");
  12. // $mail->AddAddress("ellen@example.com");                  // name is optional
  13. // $mail->AddReplyTo("info@example.com", "Information");

  14. $mail->WordWrap = 50;                                 // set word wrap to 50 characters
  15. //$mail->AddAttachment("/tmp/Authen-PAM-0.14.tar.gz");         // add attachments
  16. //$mail->AddAttachment("/tmp/image.jpg", "new.jpg");    // optional name
  17. $mail->IsHTML(true);                                  // set email format to HTML

  18. $mail->Subject = "phpMailer send page";
  19. $mail->Body    = "This is the HTML message body <b>in bold!</b>";
  20. $mail->AltBody = "This is the body in plain text for non-HTML mail clients";

  21. if(!$mail->Send())
  22. {
  23.    echo "Message could not be sent. <p>";
  24.    echo "Mailer Error: " . $mail->ErrorInfo;
  25.    exit;
  26. }

  27. echo "Message has been sent";
  28. ?>
复制代码

用IsMail方式是正常的

论坛徽章:
0
7 [报告]
发表于 2009-12-31 14:31 |只看该作者
是不是BUG 啊?

能升级版本吗?

论坛徽章:
0
8 [报告]
发表于 2009-12-31 14:34 |只看该作者
原帖由 ziggler 于 2009-12-31 14:31 发表
是不是BUG 啊?

能升级版本吗?


不太清楚,BZ看看我的配置有没有问题,好像cyrus-sasl认证好像没起作用,因为outlook发送的邮件的时候没有提示要验证帐号密码

论坛徽章:
0
9 [报告]
发表于 2009-12-31 14:38 |只看该作者

论坛徽章:
8
综合交流区版块每周发帖之星
日期:2015-12-02 15:03:53数据库技术版块每日发帖之星
日期:2015-10-02 06:20:00IT运维版块每日发帖之星
日期:2015-10-02 06:20:00IT运维版块每日发帖之星
日期:2015-09-14 06:20:00金牛座
日期:2014-10-10 11:23:34CU十二周年纪念徽章
日期:2013-10-24 15:41:34酉鸡
日期:2013-10-19 10:17:1315-16赛季CBA联赛之北京
日期:2017-03-06 15:12:44
10 [报告]
发表于 2009-12-31 19:49 |只看该作者
Dec 31 13:56:24 localhost postfix/master[26230]: warning: /usr/libexec/postfix/smtpd: bad command startup -- throttling

检查main.cf吧
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP