- 3,723,265 Users
- 2,244,521 Discussions
- 7,850,383 Comments
Forum Stats
Discussions
Categories
- 16 Data
- 362.2K Big Data Appliance
- 7 Data Science
- 2.1K Databases
- 607 General Database Discussions
- 3.7K Java and JavaScript in the Database
- 32 Multilingual Engine
- 497 MySQL Community Space
- 7 NoSQL Database
- 7.7K Oracle Database Express Edition (XE)
- 2.8K ORDS, SODA & JSON in the Database
- 421 SQLcl
- 61 SQL Developer Data Modeler
- 185.1K SQL & PL/SQL
- 21.1K SQL Developer
- 2.4K Development
- 3 Developer Projects
- 32 Programming Languages
- 135.6K Development Tools
- 12 DevOps
- 3K QA/Testing
- 334 Java
- 10 Java Learning Subscription
- 12 Database Connectivity
- 71 Java Community Process
- 2 Java 25
- 11 Java APIs
- 141.2K Java Development Tools
- 8 Java EE (Java Enterprise Edition)
- 153K Java Essentials
- 135 Java 8 Questions
- 86.2K Java Programming
- 270 Java Lambda MOOC
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 16 Java SE
- 13.8K Java Security
- 4 Java User Groups
- 22 JavaScript - Nashorn
- 18 Programs
- 147 LiveLabs
- 34 Workshops
- 10 Software
- 4 Berkeley DB Family
- 3.5K JHeadstart
- 5.7K Other Languages
- 2.3K Chinese
- 4 Deutsche Oracle Community
- 16 Español
- 1.9K Japanese
- 3 Portuguese
Query the value of CC: using Javax.mail (not really working)

Hi all,
I have an Exchange Mailbox with an email alias configured. So, when somebody send a mail to the email alias I should be able to get it with my java code to process it. The problem is the recipient id is allways populated with the root mailbox address and not with the alias previously setup.
Mailbox: [email protected]
Aliases: [email protected], [email protected]
The code to check the received mails is the following:
--------------------Java Code-----------------------
public void checkMailsTest(Store connStore, String mailAddress) throws MessagingException{
Folder folderInbox = connStore.getFolder("INBOX");
folderInbox.open(Folder.READ_WRITE);
Message[] foundMessages = folderInbox.search(new FlagTerm(new Flags(Flags.Flag.SEEN), false));
logger.info("checkMailsTest() unread e-mails found: {}", foundMessages.length);
for (int i = 0; i < foundMessages.length; i++) {
MimeMessage miMsg = (MimeMessage) foundMessages[i];
Enumeration headers = miMsg.getAllHeaders();
while(headers.hasMoreElements()){
Header header = (Header) headers.nextElement();
System.out.println(header.getName() + " : " + header.getValue());
}
}
}
----------------------End Code------------------------
Now, with the following code, I'm reading the messages and getting the header fields. So when I check the CC field is coming with the value of the mailbox name but not with the alias name. Nevertheless, if I check the message details in exchange mail application, the CC value is populated with the alias name (as it should be)
Any idea how can I get the correct CC value?
Thanks a lot in advance
BR
Max