[英]how to get the ipaddress from where each mail is sent in lotus notes
Suppose i have a mail in my lotus notes,Now i have to get from which IP address that mail is sent.How do i get the IP address in domino designer through java.Is there any header information from which i can get the IP Address. 假设我的莲花笔记中有一封邮件,现在我必须从哪个IP地址获取邮件发送。如何通过java获取多米诺设计师的IP地址。是否有任何标题信息,我可以从中获取IP地址。
I tried looking in the properties of the document but i could not find anything in there apart from which server i got the mails Please help. 我试着查看文档的属性,但我找不到任何东西,除了我收到邮件的服务器请帮忙。
A Notes mail document has an item "Received" which contains information from every server it has passed. Notes邮件文档有一个“已接收”项,其中包含已通过的每个服务器的信息。 You can't find out client's IP address this way (I think that's impossible) but you get the server's IP address at least. 您无法通过这种方式找到客户端的IP地址(我认为这是不可能的)但您至少可以获得服务器的IP地址。
It is not that easy to get ip address from item "Received" though because there are several items "Received" and with document's methods you always get only the last created. 从“已收到”项目获取IP地址并不容易,因为有几个项目“已接收”,并且使用文档的方法,您始终只获得最后创建的项目。 As a workaround you have to read item and remove item in a cycle so that you get all items "Received". 作为一种解决方法,您必须阅读项目并在周期中删除项目,以便您获得所有项目“已收到”。 Here is the Java code for getting the ip address closest to sender: 以下是获取最接近发件人的IP地址的Java代码:
private String getIPSender(Document doc) {
String ip = "";
if (doc != null) {
try {
while (doc.hasItem("Received")) {
Item item = doc.getFirstItem("Received");
if (item.getValueString().contains("[")) {
ip = item.getValueString();
}
item.remove();
}
if (!ip.isEmpty()) {
ip = ip.substring(ip.indexOf("[") + 1);
ip = ip.substring(0, ip.indexOf("]"));
}
} catch (Exception e) {
ip = "";
}
}
return ip;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.