javamail收取Hotmail的退信_MySQL
JavaMailHotmail
Hotmail 是我最常用的Email Client。虽然时下hotmail的容量是小了些,速度也常常慢得让人不禁问候盖茨的母亲。但不可否认,它功能相当丰富,也比较稳定。尤其它的页面设计更是我等web编程人员的重要参照。
不象很多的POP3服务器,hotmail 实现了邮件传送状态通知(multipart/report)。我以前写的邮件客户端只支持收取 multipart/related、multipart/alternative和multipart/mixed 等多媒体类型的邮件,其他的因为不常见,我都忽略了。
客户不答应了,那还有什么好说的,还有什么比让客户满意更重要的事情呢,在没买单之前。
multipart/report 邮件类型的介绍参见 RFC1892,Sun的中文 Javamail Faq 里也有相关的说明,我摘录如下:
问. 当消息不能被传送时,就会返回一个失败消息。我如何检测这些“回弹”消息?
答:虽然有一个 Internet 标准用于报告这样的错误(multipart/report MIME 类型,参阅 RFC1892),但还没有广泛实现它。RFC1211 深入讨论了这个问题,包括了大量的例子。
在 Internet 电子邮件中,特定的邮箱或用户名是否存在,只能由传送消息的最终服务器决定。消息可能通过几个中继服务器(它们不能检测错误),然后再到达最终服务器。通常,当最终服务器检测到这一错误,它会返回一个消息给原始消息的发送人,指出失败的原因。有许多 Internet 标准讨论了这种传送状态通知 (Delivery Status Notifications),但大量服务器不支持这些新标准,相反使用特别技术来返回这种错误消息。这使得将“回弹”消息与产生问题的原始消息相互关联起来非常困难(注意,这个问题与 JavaMail 完全无关)。
有许多技术和试探法用于处理这一问题,但它们都不是完美的。一种技术是 Variable Envelope Return Paths,http://cr.yp.to/proto/verp.txt 描述了这一技术。
我修改了程序,也只是作了些简单的处理,代码如下:
private void parseMultipart(Multipart multipart) throws Exception {
for (int i = 0, n = multipart.getCount(); i BodyPart part = multipart.getBodyPart(i);
String disposition = part.getDisposition();
if (part.isMimeType("multipart/*")) {
this.parseMultipart((Multipart) part.getContent());
} else if (part.isMimeType("text/html")) {
//处理文本内容
}
/******* 处理附件,图片等等 ********/
} else if (part.isMimeType("message/delivery-status")) {
part.setFileName("details.txt"); //仿照outlook,details.txt 内容即传送状态通知的邮件头信息
saveAttachedFile(part);
} else if (part.isMimeType("message/rfc822")) {
MimeBodyPart mbp = new MimeBodyPart(part.getInputStream());
part.setFileName(mbp.getHeader("Subject", null) + ".eml"); //仿照outlook,用退件的标题做文件名
saveAttachedFile(part);
}
}
}
如果要做得更友好,还可以做很多改进,比如根据退信找出已发送文件夹中的原件,或者激发一个通知事件等等。客户并不需要,我还是不要自作多情了。
大家都知道,hotmail 不是用pop3协议收信,而是用webdav协议。用java收发 hotmail 的邮件 ,参见《通过JavaMail访问Hotmail邮箱》。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Is the Outlook mail icon missing from Windows 11's Control Panel? This unexpected situation has caused confusion and concern among some individuals who rely on OutlookMail for their communication needs. Why don't my Outlook emails show up in Control Panel? There may be several possible reasons why there are no Outlook mail icons in Control Panel: Outlook is not installed correctly. Installing Office applications from the Microsoft Store does not add the Mail applet to Control Panel. The location of the mlcfg32.cpl file in Control Panel is missing. The path to the mlcfg32.cpl file in the registry is incorrect. The operating system is not currently configured to run this application

The message has been sent but rejected by the other party. This means that the sent information has been successfully sent from the device, but for some reason, the other party did not receive the message. More specifically, this is usually because the other party has set certain permissions or taken certain actions, which prevents your information from being received normally.

Trajectory prediction plays an important role in autonomous driving. Autonomous driving trajectory prediction refers to predicting the future driving trajectory of the vehicle by analyzing various data during the vehicle's driving process. As the core module of autonomous driving, the quality of trajectory prediction is crucial to downstream planning control. The trajectory prediction task has a rich technology stack and requires familiarity with autonomous driving dynamic/static perception, high-precision maps, lane lines, neural network architecture (CNN&GNN&Transformer) skills, etc. It is very difficult to get started! Many fans hope to get started with trajectory prediction as soon as possible and avoid pitfalls. Today I will take stock of some common problems and introductory learning methods for trajectory prediction! Introductory related knowledge 1. Are the preview papers in order? A: Look at the survey first, p

StableDiffusion3’s paper is finally here! This model was released two weeks ago and uses the same DiT (DiffusionTransformer) architecture as Sora. It caused quite a stir once it was released. Compared with the previous version, the quality of the images generated by StableDiffusion3 has been significantly improved. It now supports multi-theme prompts, and the text writing effect has also been improved, and garbled characters no longer appear. StabilityAI pointed out that StableDiffusion3 is a series of models with parameter sizes ranging from 800M to 8B. This parameter range means that the model can be run directly on many portable devices, significantly reducing the use of AI

In network data transmission, IP proxy servers play an important role, helping users hide their real IP addresses, protect privacy, and improve access speeds. In this article, we will introduce the best practice guide on how to build an IP proxy server with PHP and provide specific code examples. What is an IP proxy server? An IP proxy server is an intermediate server located between the user and the target server. It acts as a transfer station between the user and the target server, forwarding the user's requests and responses. By using an IP proxy server

The role of a DHCP relay is to forward received DHCP packets to another DHCP server on the network, even if the two servers are on different subnets. By using a DHCP relay, you can deploy a centralized DHCP server in the network center and use it to dynamically assign IP addresses to all network subnets/VLANs. Dnsmasq is a commonly used DNS and DHCP protocol server that can be configured as a DHCP relay server to help manage dynamic host configurations in the network. In this article, we will show you how to configure dnsmasq as a DHCP relay server. Content Topics: Network Topology Configuring Static IP Addresses on a DHCP Relay D on a Centralized DHCP Server

This paper explores the problem of accurately detecting objects from different viewing angles (such as perspective and bird's-eye view) in autonomous driving, especially how to effectively transform features from perspective (PV) to bird's-eye view (BEV) space. Transformation is implemented via the Visual Transformation (VT) module. Existing methods are broadly divided into two strategies: 2D to 3D and 3D to 2D conversion. 2D-to-3D methods improve dense 2D features by predicting depth probabilities, but the inherent uncertainty of depth predictions, especially in distant regions, may introduce inaccuracies. While 3D to 2D methods usually use 3D queries to sample 2D features and learn the attention weights of the correspondence between 3D and 2D features through a Transformer, which increases the computational and deployment time.

What should I do if I can’t enter the game when the epic server is offline? This problem must have been encountered by many friends. When this prompt appears, the genuine game cannot be started. This problem is usually caused by interference from the network and security software. So how should it be solved? The editor of this issue will explain I would like to share the solution with you, I hope today’s software tutorial can help you solve the problem. What to do if the epic server cannot enter the game when it is offline: 1. It may be interfered by security software. Close the game platform and security software and then restart. 2. The second is that the network fluctuates too much. Try restarting the router to see if it works. If the conditions are OK, you can try to use the 5g mobile network to operate. 3. Then there may be more
