发送邮件服务器连接错误什么意思,SMTP 错误(-1) :连接服务器失败

10031 policyd 服务起不来。

/etc/init.d/policyd restart 每回都是报一个致命错误,然后显示启动成功。

mailog:

Sep  4 20:50:20 mail postfix/smtpd[28117]: connect from mail.xcxxc.cn[127.0.0.1]

Sep  4 20:50:20 mail postfix/smtpd[28117]: EAD63C47906A: client=mail.xcxxc.cn[127.0.0.1], sasl_method=LOGIN, sasl_username=luoxiangru@zzb.zh

Sep  4 20:50:21 mail postfix/cleanup[28121]: EAD63C47906A: message-id=<4202ede6fabd35d881a24ef29c6e1f54@zzb.zh>

Sep  4 20:50:21 mail postfix/qmgr[28048]: EAD63C47906A: from=, size=553, nrcpt=1 (queue active)

Sep  4 20:50:21 mail roundcube: User luoxiangru@zzb.zh [21.99.0.67]; Message for www@zzb.zh; 250: 2.0.0 Ok: queued as EAD63C47906A

Sep  4 20:50:21 mail postfix/smtpd[28117]: disconnect from mail.xcxxc.cn[127.0.0.1]

Sep  4 20:50:21 mail postfix/smtpd[28125]: connect from mail.xcxxc.cn[127.0.0.1]

Sep  4 20:50:21 mail postfix/smtpd[28125]: 23C27C479071: client=mail.xcxxc.cn[127.0.0.1]

Sep  4 20:50:21 mail postfix/cleanup[28121]: 23C27C479071: message-id=<4202ede6fabd35d881a24ef29c6e1f54@zzb.zh>

Sep  4 20:50:21 mail postfix/smtpd[28125]: disconnect from mail.xcxxc.cn[127.0.0.1]

Sep  4 20:50:21 mail postfix/qmgr[28048]: 23C27C479071: from=, size=1465, nrcpt=1 (queue active)

Sep  4 20:50:21 mail amavis[27977]: (27977-01) Passed CLEAN, MYNETS/MYUSERS LOCAL [127.0.0.1] [127.0.0.1] -> , Message-ID: <4202ede6fabd35d881a24ef29c6e1f54@zzb.zh>, mail_id: 4JvNSvWLdIrJ, Hits: -4.059, size: 553, queued_as: 23C27C479071, 150 ms

Sep  4 20:50:21 mail postfix/pipe[28126]: 23C27C479071: to=, relay=dovecot, delay=0.01, delays=0/0/0/0.01, dsn=4.3.0, status=deferred (temporary failure)

Sep  4 20:50:21 mail postfix/smtp[28122]: EAD63C47906A: to=, relay=127.0.0.1[127.0.0.1]:10024, delay=0.22, delays=0.06/0/0.01/0.15, dsn=2.0.0, status=sent (250 2.0.0 Ok, id=27977-01, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 23C27C479071)

Sep  4 20:50:21 mail postfix/qmgr[28048]: EAD63C47906A: removed

Sep 04 23:24:56 managesieve-login: Fatal: Dovecot version mismatch: Master is v1.2.17, login is v1.2.16 (if you don't care, set version_ignore=yes)

Sep 04 23:24:56 managesieve-login: Fatal: Dovecot version mismatch: Master is v1.2.17, login is v1.2.16 (if you don't care, set version_ignore=yes)

Sep 04 23:24:56 managesieve-login: Fatal: Dovecot version mismatch: Master is v1.2.17, login is v1.2.16 (if you don't care, set version_ignore=yes)

Sep 04 23:24:56 dovecot: Info: Created login processes successfully, unstalling

Sep 04 23:24:57 managesieve-login: Fatal: Dovecot version mismatch: Master is v1.2.17, login is v1.2.16 (if you don't care, set version_ignore=yes)

Sep 04 23:24:57 managesieve-login: Fatal: Dovecot version mismatch: Master is v1.2.17, login is v1.2.16 (if you don't care, set version_ignore=yes)

Sep 04 23:24:57 dovecot: Error: Temporary failure in creating login processes, slowing down for now

Sep 04 23:24:57 managesieve-login: Fatal: Dovecot version mismatch: Master is v1.2.17, login is v1.2.16 (if you don't care, set version_ignore=yes)

Sep 04 23:25:41 imap-login: Info: Login: user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured

Sep 04 23:25:41 IMAP(gyj@zzb.zh): Info: Disconnected: Logged out bytes=233/991

netstat -tnpl

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name

tcp        0      0 127.0.0.1:2208              0.0.0.0:*                   LISTEN      4960/hpiod

tcp        0      0 0.0.0.0:993                 0.0.0.0:*                   LISTEN      4313/imap-login

tcp        0      0 127.0.0.1:7777              0.0.0.0:*                   LISTEN      5891/python

tcp        0      0 0.0.0.0:962                 0.0.0.0:*                   LISTEN      4596/rpc.statd

tcp        0      0 0.0.0.0:995                 0.0.0.0:*                   LISTEN      29225/dovecot

tcp        0      0 127.0.0.1:10024             0.0.0.0:*                   LISTEN      30249/amavisd (mast

tcp        0      0 127.0.0.1:10025             0.0.0.0:*                   LISTEN      29308/master

tcp        0      0 0.0.0.0:3306                0.0.0.0:*                   LISTEN      5087/mysqld

tcp        0      0 0.0.0.0:587                 0.0.0.0:*                   LISTEN      29308/master

tcp        0      0 127.0.0.1:9998              0.0.0.0:*                   LISTEN      30249/amavisd (mast

tcp        0      0 0.0.0.0:110                 0.0.0.0:*                   LISTEN      29225/dovecot

tcp        0      0 0.0.0.0:143                 0.0.0.0:*                   LISTEN      4313/imap-login

tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      4505/portmap

tcp        0      0 127.0.0.1:2000              0.0.0.0:*                   LISTEN      29225/dovecot

tcp        0      0 0.0.0.0:465                 0.0.0.0:*                   LISTEN      29308/master

tcp        0      0 127.0.0.1:631               0.0.0.0:*                   LISTEN      4976/cupsd

tcp        0      0 0.0.0.0:25                  0.0.0.0:*                   LISTEN      29308/master

tcp        0      0 127.0.0.1:2207              0.0.0.0:*                   LISTEN      4966/python

tcp        0      0 :::80                       :::*                        LISTEN      29406/httpd

tcp        0      0 :::22                       :::*                        LISTEN      4518/sshd

tcp        0      0 :::443                      :::*                        LISTEN      29406/httpd

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
你可以使用 JavaMail API 来连接邮件服务器发送邮件。在连接邮件服务器时,你可以使用一个循环,尝试连接邮件服务器发送邮件。如果连接失败,你可以在循环中重新尝试连接邮件服务器。以下是一个示例代码: ```java import javax.mail.*; import javax.mail.internet.*; import java.util.Properties; public class MailSender { private static final int MAX_ATTEMPTS = 3; public void sendMail(String recipient, String subject, String body) { Properties props = new Properties(); props.put("mail.smtp.host", "your_mail_server"); props.put("mail.smtp.port", "your_mail_server_port"); Session session = Session.getInstance(props, null); int attempts = 0; boolean success = false; while (!success && attempts < MAX_ATTEMPTS) { try { Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress("your_email_address")); msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(recipient, false)); msg.setSubject(subject); msg.setText(body); Transport.send(msg); success = true; } catch (MessagingException e) { attempts++; System.out.println("Failed to send email: " + e.getMessage()); System.out.println("Retrying connection... (attempt " + attempts + ")"); } } if (!success) { System.out.println("Failed to send email after " + MAX_ATTEMPTS + " attempts."); } } } ``` 在上述代码中,我们使用了一个名为 `MAX_ATTEMPTS` 的常量,它定义了我们最多尝试连接邮件服务器的次数。在 `sendMail()` 方法内部,我们使用一个 while 循环来尝试连接邮件服务器发送邮件。如果连接或发送失败,则增加尝试次数并重新尝试连接邮件服务器。如果我们超过了最大尝试次数,我们将打印一条错误消息。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值