contact.setContentType(ContactVO.ContentType.PLAINTEXT);
else
contact.setContentType(ContactVO.ContentType.HTML);
// Absender
List<PersonVO> senders = new PersonDAO().getByMail(mail.getSender().toString());
if (!senders.isEmpty())
for (PersonVO person : senders)
{
pc = new PersonContactVO(person, contact);
pc.setRelationType(PersonContactVO.Type.SENDER);
pcs.add(pc);
if ((mailetContext.isLocalUser(mail.getSender().getUser())) && mailetContext.isLocalServer(mail.getSender().getHost()))
{
contact.setBoundType(ContactVO.BoundType.OUT);
}
}
else
contact.setContactName("From: " + mail.getSender().toString());
// Emfaenger TO
Address[] addresses = message.getRecipients(MimeMessage.RecipientType.TO);
for (Address address : addresses)
{
recipient = address.toString();
List<PersonVO> recipients = new PersonDAO().getByMail(recipient);
if (!recipients.isEmpty())
for (PersonVO person : recipients)
{
pc = new PersonContactVO(person, contact);
pc.setRelationType(PersonContactVO.Type.TO);
pcs.add(pc);
}
else if (contact.getContactName() == null)
contact.setContactName("To: " + recipient);
else
contact.setContactName(contact.getContactName() + ", To: " + recipient);
}
// Emfaenger CC
addresses = message.getRecipients(MimeMessage.RecipientType.CC);
if (addresses != null)
for (Address address : addresses)
{
recipient = address.toString();
List<PersonVO> recipients = new PersonDAO().getByMail(recipient);
if (!recipients.isEmpty())
for (PersonVO person : recipients)
{
pc = new PersonContactVO(person, contact);
pc.setRelationType(PersonContactVO.Type.CC);
pcs.add(pc);
}
else if (contact.getContactName() == null)
contact.setContactName("CC: " + recipient);
else
contact.setContactName(contact.getContactName() + ", CC: " + recipient);
}
// Emfaenger BCC
addresses = message.getRecipients(MimeMessage.RecipientType.BCC);
if (addresses != null)
for (Address address : addresses)
{
recipient = address.toString();
List<PersonVO> recipients = new PersonDAO().getByMail(recipient);
if (!recipients.isEmpty())
for (PersonVO person : recipients)
{
pc = new PersonContactVO(person, contact);
pc.setRelationType(PersonContactVO.Type.BCC);