简体   繁体   English

VERP与JavaMail和Postfix,如何?

[英]VERP with JavaMail and Postfix, How To?

First of all, Greetings! 首先,问候!

I am about to Develop aa custom newsletter application in Java using the Javax.mail API. 我将使用Javax.mail API在Java中开发一个自定义新闻稿应用程序。 So I need to Develop a Verp technique in order to track bounces. 所以我需要开发一个Verp技术来跟踪反弹。

So far I have Override the javax.mail.internet.MimeMessage Just to handle my own Mail headers. 到目前为止,我已覆盖javax.mail.internet.MimeMessage只是为了处理我自己的邮件头。

class CustomMailMessage extends MimeMessage
...
public void setCustomHeader(key, value)
{
    setHeader(key, value);
    updateHeaders();
}
...

So this seems to work with any header that I set except the Return-Path. 所以这似乎适用于我设置的任何标题,除了Return-Path。

...
setCustomHeader("Return-Path",verpAddr);
...

Resulting a VERP failure. 导致VERP失败。 I have track the value of this header just before and after I call 我在调用之前和之后都跟踪了这个标题的值

...
Transport.send(message);
...

and it seems that the value is the same as I have set it. 而且似乎该值与我设置的值相同。 Yet, at the received mail the return-path is changed to the sender address (From:). 然而,在收到的邮件中,返回路径被更改为发件人地址(From :)。 unlike the rest of the headers are as they were set. 与其他标题不同的是它们的设置。 And so the bounce notification is delivered to the sender rather than my bounce+usermail=host@mydomain.com . 因此退回通知会发送给发件人而不是我的bounce+usermail=host@mydomain.com。

I think that this failure is on postfix site. 我认为这个失败是在postfix网站上。

Note that the server is set by Plesk, and my domain.com is shared on my server. 请注意,服务器由Plesk设置,我的domain.com在我的服务器上共享。

So I please anyone that may assist me. 所以我请任何可以帮助我的人。 Or can provide me more info on how to achieve differently a Verp technique. 或者可以为我提供有关如何实现不同Verp技术的更多信息。

Thx in Advance & Cheers! Thx in Advance&Cheers!

The Return-Path header is set by the receiver, not the sender. Return-Path标头由接收方设置,而不是发送方。

You want to set the "envelope from" address. 您想要设置“信封来自”地址。 See the javadocs for the com.sun.mail.smtp package for the property to set, and see the SMTPMessage class as another way to set this information. 有关要设置的属性,请参阅com.sun.mail.smtp包javadocs ,并将SMTPMessage类视为设置此信息的另一种方法。

Note also that you don't need to subclass MimeMessage just to set custom headers. 另请注意,您不需要将MimeMessage子类化以设置自定义标头。 You can call the setHeader method directly and updateHeaders will be called before the message is sent. 您可以直接调用setHeader方法,并在发送消息之前调用updateHeaders。 (And updateHeaders won't do anything with these custom headers anyway.) (并且updateHeaders无论如何都不会对这些自定义标头做任何事情。)

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

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