You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by Dinyar Rabady <Di...@catalysts.cc> on 2012/04/30 16:25:25 UTC

Constructing a MailImpl object from a Mail object whitout losing headers

 Hi!

I am trying to implement VERP in the following way:

                String address = recipient.toString();
                MailImpl verpMail = new MailImpl(mail);
                String verpFrom = "my-reverse-path@localdomain.tld"
                MailAddress reversePath = new MailAddress(verpFrom);
                verpMail.setSender(reversePath);
                verpMail.getMessage().setHeader(RFC2822Headers.RETURN_PATH, /* my reverse path */);
                // This is a header used by very old versions of sendmail to find the bounce address.
                verpMail.getMessage().setHeader("Errors-To", /* my reverse path */);
                // A header set by Amazon.
                verpMail.getMessage().setHeader("Bounces-to", /* my reverse path */);
                verpMail.getMessage().saveChanges();
                getMailetContext().sendMail(verpMail);
                mail.setState(Mail.GHOST);

But it seems that the headers from the original 'mail' object (not the headers I am setting here) are lost. Is this on prupose and is there a way for me to circumvent this?

Best,
Dinyar

Re: AW: Constructing a MailImpl object from a Mail object whitout losing headers

Posted by Eric Charles <er...@apache.org>.
np. Thx to have closed the loop Dinyar.
Eric

On 05/02/2012 10:04 AM, Dinyar Rabady wrote:
> Hi!
>
> Thanks for the fast answer, but I'm afraid there was stupidity on my part involved -- the headers are actually there, I just misdiagnosed my problem..
>
> Sorry for the false alarm,
> Dinyar
> ________________________________________
> Von: Eric Charles [eric@apache.org]
> Gesendet: Dienstag, 01. Mai 2012 12:34
> An: James Users List
> Betreff: Re: Constructing a MailImpl object from a Mail object whitout losing headers
>
> Hi Dinyar,
>
> So you run this code in a mailet and the original headers are no more there?
>
> If you can send us (on via a JIRA, or a gist) the full code, we could
> take a look at it to help.
>
> Thx,
> Eric
>
>
> On 04/30/2012 04:25 PM, Dinyar Rabady wrote:
>>    Hi!
>>
>> I am trying to implement VERP in the following way:
>>
>>                   String address = recipient.toString();
>>                   MailImpl verpMail = new MailImpl(mail);
>>                   String verpFrom = "my-reverse-path@localdomain.tld"
>>                   MailAddress reversePath = new MailAddress(verpFrom);
>>                   verpMail.setSender(reversePath);
>>                   verpMail.getMessage().setHeader(RFC2822Headers.RETURN_PATH, /* my reverse path */);
>>                   // This is a header used by very old versions of sendmail to find the bounce address.
>>                   verpMail.getMessage().setHeader("Errors-To", /* my reverse path */);
>>                   // A header set by Amazon.
>>                   verpMail.getMessage().setHeader("Bounces-to", /* my reverse path */);
>>                   verpMail.getMessage().saveChanges();
>>                   getMailetContext().sendMail(verpMail);
>>                   mail.setState(Mail.GHOST);
>>
>> But it seems that the headers from the original 'mail' object (not the headers I am setting here) are lost. Is this on prupose and is there a way for me to circumvent this?
>>
>> Best,
>> Dinyar
>>
>
> --
> eric | http://about.echarles.net | @echarles
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>

-- 
eric | http://about.echarles.net | @echarles

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


AW: Constructing a MailImpl object from a Mail object whitout losing headers

Posted by Dinyar Rabady <Di...@catalysts.cc>.
Hi!

Thanks for the fast answer, but I'm afraid there was stupidity on my part involved -- the headers are actually there, I just misdiagnosed my problem..

Sorry for the false alarm,
Dinyar
________________________________________
Von: Eric Charles [eric@apache.org]
Gesendet: Dienstag, 01. Mai 2012 12:34
An: James Users List
Betreff: Re: Constructing a MailImpl object from a Mail object whitout losing headers

Hi Dinyar,

So you run this code in a mailet and the original headers are no more there?

If you can send us (on via a JIRA, or a gist) the full code, we could
take a look at it to help.

Thx,
Eric


On 04/30/2012 04:25 PM, Dinyar Rabady wrote:
>   Hi!
>
> I am trying to implement VERP in the following way:
>
>                  String address = recipient.toString();
>                  MailImpl verpMail = new MailImpl(mail);
>                  String verpFrom = "my-reverse-path@localdomain.tld"
>                  MailAddress reversePath = new MailAddress(verpFrom);
>                  verpMail.setSender(reversePath);
>                  verpMail.getMessage().setHeader(RFC2822Headers.RETURN_PATH, /* my reverse path */);
>                  // This is a header used by very old versions of sendmail to find the bounce address.
>                  verpMail.getMessage().setHeader("Errors-To", /* my reverse path */);
>                  // A header set by Amazon.
>                  verpMail.getMessage().setHeader("Bounces-to", /* my reverse path */);
>                  verpMail.getMessage().saveChanges();
>                  getMailetContext().sendMail(verpMail);
>                  mail.setState(Mail.GHOST);
>
> But it seems that the headers from the original 'mail' object (not the headers I am setting here) are lost. Is this on prupose and is there a way for me to circumvent this?
>
> Best,
> Dinyar
>

--
eric | http://about.echarles.net | @echarles

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: Constructing a MailImpl object from a Mail object whitout losing headers

Posted by Eric Charles <er...@apache.org>.
Hi Dinyar,

So you run this code in a mailet and the original headers are no more there?

If you can send us (on via a JIRA, or a gist) the full code, we could 
take a look at it to help.

Thx,
Eric


On 04/30/2012 04:25 PM, Dinyar Rabady wrote:
>   Hi!
>
> I am trying to implement VERP in the following way:
>
>                  String address = recipient.toString();
>                  MailImpl verpMail = new MailImpl(mail);
>                  String verpFrom = "my-reverse-path@localdomain.tld"
>                  MailAddress reversePath = new MailAddress(verpFrom);
>                  verpMail.setSender(reversePath);
>                  verpMail.getMessage().setHeader(RFC2822Headers.RETURN_PATH, /* my reverse path */);
>                  // This is a header used by very old versions of sendmail to find the bounce address.
>                  verpMail.getMessage().setHeader("Errors-To", /* my reverse path */);
>                  // A header set by Amazon.
>                  verpMail.getMessage().setHeader("Bounces-to", /* my reverse path */);
>                  verpMail.getMessage().saveChanges();
>                  getMailetContext().sendMail(verpMail);
>                  mail.setState(Mail.GHOST);
>
> But it seems that the headers from the original 'mail' object (not the headers I am setting here) are lost. Is this on prupose and is there a way for me to circumvent this?
>
> Best,
> Dinyar
>

-- 
eric | http://about.echarles.net | @echarles

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org