繁体   English   中英

不接收本地主机Mercury邮件发送的电子邮件

[英]Not Receiving email sent by localhost Mercury mail

我正在使用XAMPP将我的Java应用程序部署在tomcat中,也使用了水银邮件发送电子邮件。 现在,我只是使用Java邮件API和水银电子邮件使用小型Java程序测试我的应用程序。 我已经在Mercury中完成了必要的配置,以设置本地主机。 我的程序运行成功,没有任何错误。 此外,Mercury日志文件没有任何有关任何错误的信息。

T 20130411 044359 51663963 Connection from 127.0.0.1
T 20130411 044359 51663963 EHLO 10.226.44.101
T 20130411 044359 51663963 MAIL FROM:<promil@localhost.com>
T 20130411 044359 51663963 RCPT TO:<*****@gmail.com>
T 20130411 044359 51663963 DATA
T 20130411 044359 51663963 DATA - 22 lines, 689 bytes.
T 20130411 044359 51663963 QUIT
T 20130411 044359 51663963 Connection closed with 127.0.0.1, 0 sec. elapsed.

这也是我的java文件。

公共静态void main(String [] args){

      // Recipient's email ID needs to be mentioned.
      String to = "****@gmail.com";

      // Sender's email ID needs to be mentioned
      String from = "promil@localhost.com";

      // Assuming you are sending email from localhost
      String host = "localhost";
      String password = "****";

      // Get system properties
      Properties properties = System.getProperties();

      // Setup mail server
      properties.setProperty("mail.smtp.host", host);

   // Setup mail server
      properties.setProperty("mail.smtp.password", password);

      // Get the default Session object.
      Session session = Session.getDefaultInstance(properties);

      try{
         // Create a default MimeMessage object.
         MimeMessage message = new MimeMessage(session);

         // Set From: header field of the header.
         message.setFrom(new InternetAddress(from));

         // Set To: header field of the header.
         message.addRecipient(Message.RecipientType.TO,
                                  new InternetAddress(to));

         // Set Subject: header field
         message.setSubject("This is the Subject Line!");

         // Create the message part 
         BodyPart messageBodyPart = new MimeBodyPart();

         // Fill the message
         messageBodyPart.setText("This is message body");

         // Create a multipar message
         Multipart multipart = new MimeMultipart();

         // Set text message part
         multipart.addBodyPart(messageBodyPart);

         // Part two is attachment
         messageBodyPart = new MimeBodyPart();
         String filename = "C:/Users/toshiba/Desktop/file.txt";
         DataSource source = new FileDataSource(filename);
         messageBodyPart.setDataHandler(new DataHandler(source));
         messageBodyPart.setFileName(filename);
         multipart.addBodyPart(messageBodyPart);

         // Send the complete message parts
         message.setContent(multipart );

         // Send message
         Transport.send(message);
         System.out.println("Sent message successfully....");
      }catch (MessagingException mex) {
         mex.printStackTrace();
      }

我对此一无所知.....我的Mercury核心流程还说它有4个待处理的外发工作.... ???

目标地址是gmail。 您尚未弄清邮件是应该在本地还是通过gmail传递的,因此,我假设您的意思是将邮件发送到Gmail帐户,该帐户已(正确地)混淆了您的帖子。

您发布的会话记录在Java客户端和本地Mercury邮件服务器之间。 这说明本地Mercury邮件服务器接受了来自Java客户端的邮件。

会话记录不包含有关本地Mercury邮件服务器接受邮件后邮件发生了什么情况的信息。 如果正确设置了本地配置,则Mercury邮件应该已经尝试通过查找Gmail的MX记录并连接到MX查找返回的服务器之一来转发该邮件。

有关更多信息,您将必须查看Mercury服务器的日志以查看其是否尝试传递消息。

一个推测:

您的Mercury邮件服务器尝试发送邮件,但Gmail拒绝了,因为您所运行的计算机具有ISP分配的DHCP(动态)地址。 大量的SPAM源自此类地址,许多邮件主机甚至拒绝与这些邮件源进行对话。 无论如何,如果Gmail拒绝了它,则需要Mercury邮件将其“退回”给发件人。 但是,您可能尚未为promil@localhost.com设置传入邮箱,因此它没有地方存储退回邮件,只是丢弃了退回邮件。 再次,检查Mercury邮件日志以获取详细信息。

这是任何人都可以根据您提供的信息给出的最佳答案。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM