Javamail: 电子邮件已从程序中成功删除,但未送达 Windows Server 2012 r2
我陷入了这个问题。
我的程序成功地从我的电脑中提供了电子邮件 Windows 10 和 Windows Server 2012 R2 Essential, 但是通过任何其他送他们
版本 Windows Server 2012
显示为成功发送,但未传递电子邮件。
尝试了所有组合
SSL / TLS / 没有身份验证
以及所有端口
465/587/26.
这是我使用的代码
我也试图使用 Jodd Mail Library, 它再现了它让我有理由相信问题在OS中的同样的情况。
我的程序成功地从我的电脑中提供了电子邮件 Windows 10 和 Windows Server 2012 R2 Essential, 但是通过任何其他送他们
版本 Windows Server 2012
显示为成功发送,但未传递电子邮件。
尝试了所有组合
SSL / TLS / 没有身份验证
以及所有端口
465/587/26.
这是我使用的代码
String port = "26";
// Recipient's email ID needs to be mentioned.
String to = "*****@gmail.com";
// Sender's email ID needs to be mentioned
String host = "mail.*****.com.pk";
String username = "sales@*****.com.pk";//change accordingly
String password = "*****";//change accordingly
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.host", host);
props.put("mail.smtp.port", port);
// SSL Factory
// props.put("mail.smtp.socketFactory.class",
// "javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.starttls.enable", "false");
System.out.println("TLS Settings False");
System.out.println("Sending with port: " + port);
// Get the Session object.
Session session = Session.getInstance(props,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
try {
// Create a default MimeMessage object.
Message message = new MimeMessage(session);
// Set From: header field of the header.
message.setFrom(new InternetAddress(username));
// Set To: header field of the header.
message.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(to));
// Set Subject: header field
message.setSubject("Testing Subject from ******.com.pk");
// Now set the actual message
message.setText("Hello, this is sample for to check send " +
"email using JavaMailAPI on personal workstation ");
// Send message
Transport.send(message);
System.out.println("Sent message successfully....");
} catch (MessagingException e) {
throw new RuntimeException(e);
}
我也试图使用 Jodd Mail Library, 它再现了它让我有理由相信问题在OS中的同样的情况。
没有找到相关结果
已邀请:
1 个回复
冰洋
赞同来自:
故障排除由您接受的邮件进行故障排除的重要问题 MTA, 但未送到收件人,介绍交付速度如何查找从同一服务器发送的另一封邮件,尤其是在与程序中显式拒绝邮件的同一域中。
从安全邮件服务器的配置开始,您可以做一些可以做的事情来增加拯救 (那些。 不是垃圾邮件的来源), 然后正确应用了记录 / 总位领先 SPF, DKIM 和 DMARC 在你的 DNS + MTA.