I tried activating the ToSenderFolder mailet and could not get it to
work. I added some debug code and looked through the source, and I see
where the problem is.
The mailet assumes that the username (user login name / repository name)
is the sender's email address. (see code snippit at the bottom of this
post). Where this 'could' be the case, and could be argued that it's
that way in many situations, it's not required. My login id for my mail
account is "m...@mycompany.net". I have several employees that share
this one account. However, they send mail as j...@mycompany.net,
b...@mycompany.net, and su...@mycompany.net. I use the virtual recipient
rewrite function to map all of these ids to the m...@mycompany.net
repository.
The problem in the mailet is that it is trying to put sent mail in
j...@mycompany.net/Sent, etc. which is not a valid repository.
In order to fix this, I need to figure out the real username that was
used to log in to SMTP. I suspect you're going to tell me that there's
not a way in the world to get addressability to the real username inside
a mailet, right...? I guess the next option would be to use the
recipient rewrite table in the db to map the sender to the repository.
I'll look around for a recipient rewrite mapping class that I can use.
Or I guess I could just brute-force it directly with a SQL query to the
table in the db. Either way, I should be able to determine the real
repository name so the mailet can know where to put the Sent message.
I believe there is a philosophical design problem currently in the
mailet to assume the sender email address is the repository name. But
since I need to go ahead and fix this, I'd like to know what the James
team would suggest to be the 'right way' to implement the fix.
Suggestions?
Thx.
Jerry
------------------------------------------------------ code snippit-->
String username;
try {
if (usersRepository.supportVirtualHosting()) {
username = sender.toString();
}
else {
username = sender.getLocalPart();
}
} catch (UsersRepositoryException e) {
throw new MessagingException(e.getMessage());
}