如何使用JavaMail API接收发送电子邮件的确认? [英] How can I recieive confirmation for delivered email with JavaMail API?

查看:392
本文介绍了如何使用JavaMail API接收发送电子邮件的确认?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个程序,发送电子邮件,想知道接收者何时收到我发给他的电子邮件。如何使用JavaMail API来执行此操作?



如果我使用SMTPMessage,那么在设置通知选项后如何处理结果?

  SMTPMessage smtpMsg =新的SMTPMessage(msg); 
smtpMsg.setNotifyOptions(SMTPMessage.NOTIFY_SUCCESS);


解决方案

没有标准的方法来做到这一点被接受,全面荣誉我看到你有一些选择,但是:




  • 使用您的电子邮件添加标题Return-Receipt-To地址中的值。如果电子邮件的收件人有一个尊重此标题的客户端,那么当打开电子邮件时,您将收到一封返回收据。这是不可靠的,记住你,因为用户总是可以决定不发送收据,即使他有一个支持它的客户端。


  • 添加一个图像放入从您的服务器加载的电子邮件中,并在包含用户电子邮件地址的图像上放置一个参数。加载电子邮件时,图像将从您的服务器加载。编写一个收集电子邮件参数的脚本,然后传递一个空白图像。这也是不可靠的,但是,尽管许多邮件客户端提示用户,如果他们希望下载图像,他们总是可以选择不。另外,一些(大多是较旧的)电子邮件客户端不支持图像。


  • 也许最可靠的方法是不要将邮件包含在您的电子邮件中在所有仅包含指向可以读取消息的网站的链接,并在链接中包含其电子邮件地址或唯一代码。这样,你确切知道读者的消息。当然,这样做是有缺点的,人们实际上并没有收到他们的收件箱信息,他们也可能选择不去网站阅读。




最终,我想你将不得不提出一个创造性的解决方案来解决这个问题,除非你很高兴得到很多结果。


I'm writing a program, that sends email messages and want to know when the receiver receives the email message I've sent to him. How can I do this using JavaMail API?

If I use SMTPMessage, how exactly to deal with the result after I've set the notify options?

SMTPMessage smtpMsg = new SMTPMessage(msg);
smtpMsg.setNotifyOptions(SMTPMessage.NOTIFY_SUCCESS);

解决方案

There is no standard way of doing this that's accepted and honored across the board. I see that you have some options, though:

  • Add a header "Return-Receipt-To" with your e-mail address in the value. If the recipient of the e-mail has a client which honors this header, then a return receipt will be sent to you when the e-mail is opened. This is not reliable, mind you, as the user can always decide not to send the receipt, even if he has a client that supports it.

  • Add an image into your e-mail that loads from your server and put a parameter on the image that includes the user's e-mail address. When the e-mail loads, the image will load from your server. Write a script that collects the e-mail parameter and then delivers a blank image. This is also not reliable, however, as many mail clients prompt users if they wish to download images and they can always choose not to. Also, some (mostly older) e-mail clients do not support images.

  • Perhaps the most reliable way is not to include the message in your e-mail at all. Include only a link to a website where the message can be read, and include their e-mail address or a unique code in the link. This way, you know exactly who read the message. Of course, this has the downside that people aren't actually getting the message in their inbox, and they also may choose not to go to the website to read it.

Ultimately, I think you're going to have to come up with a creative solution to solve this problem, unless you're happy getting spotty results.

这篇关于如何使用JavaMail API接收发送电子邮件的确认?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆