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 Danny Angus <da...@apache.org> on 2003/04/03 13:03:14 UTC

mail.getSender (was RE: Redirect getSender bad, Forward getSender good?)

John,

Keep these things on the list, then it can help others as well.


> My matcher code is simply this:   (just showing how I get the sender here)
> 
>     public Collection match(Mail mail) {
>         log("Sender: " + mail.getSender().toString());


This is nothing to do with redirect or any other Mailet then, and from the look of it it ought to be returning the sender as notified in the SMTP "MAIL FROM" command, this is not the same as the "From" header of the message.

If you want the "From" header of the message you should do.. mail.getMessage().getSender() or mail.getMessage().getHeader("From")

I would experiment to see whats going on here (but I don't have time right now) you might want to create a matcher like "SenderIs" but instead of doing anything make it print mail.getSender() and mail.getMessage().getSender() to the console, then send some mail and see if you can make out what is happening.

You might want to try using SMTP manually, so you *know* what the SMTP sender and the message From: addresses are, if so try this...
you type lines beginning >> responses will look like << (theres more discussion below..)

>>telnet localhost 25
<<Trying 127.0.0.1...
<<Connected to killerbees.co.uk.
<<Escape character is '^]'.
<<220 killerbees.co.uk SMTP Server (JAMES SMTP Server 3.0a1) ready Thu, 3 Apr 2003 11:56:10 +0100 (BST)
>>MAIL FROM:<da...@apache.org>
<<250 Sender <da...@apache.org> OK
>>RCPT TO:<da...@killerbees.co.uk>
<<250 Recipient <da...@killerbees.co.uk> OK
>>DATA
<<354 Ok Send data ending with <CRLF>.<CRLF>
>>Subject: test
>>From: danny@autonomous.co.uk
>>
>>body
>>.
<<250 Message received
>>quit
<<221 killerbees.co.uk Service closing transmission channel
<<Connection closed by foreign host.



> The problem I'm seeing is this getSender on the mail object keeps 
> returning
> the first sender received after James started up instead of the 
> new ones for
> each subsequent mail.

This is unlikely in a matcher and would be a serious bug, I'm not saying you are wrong, just its more likely something else.

> I've done a lot more testing and I'm afraid my subject may be misleading -
> I'm seeing the same problem when I use the Forward mailet with 
> the SenderIs
> matcher.

Yeah, am I right in thinking that this is actually a problem you're having with "SenderIs"?

d.


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