Exemplo n.º 1
0
 static String[] composeReadableRecipientList(SimpleEmail email) {
   String[] RRL = {"To: ", "Cc: ", "Bcc: "};
   Iterator<String> toIT = Utils.noGenericTypeToStringType(email.getToAddresses()).iterator(),
       ccIT = Utils.noGenericTypeToStringType(email.getCcAddresses()).iterator(),
       bccIT = Utils.noGenericTypeToStringType(email.getBccAddresses()).iterator();
   while (toIT.hasNext()) {
     RRL[0] += toIT.next() + ", ";
   }
   while (ccIT.hasNext()) {
     RRL[1] += ccIT.next() + ", ";
   }
   while (bccIT.hasNext()) {
     RRL[2] += bccIT.next() + ", ";
   }
   return RRL;
 }
Exemplo n.º 2
0
 static SimpleEmail removeRecipient(SimpleEmail email, String emailToRemove)
     throws EmailException {
   List<String> to = Utils.noGenericTypeToStringType(email.getToAddresses()),
       cc = Utils.noGenericTypeToStringType(email.getCcAddresses()),
       bcc = Utils.noGenericTypeToStringType(email.getBccAddresses());
   if (to.contains(emailToRemove)) {
     to.remove(emailToRemove);
     email.setTo(to);
   } else if (cc.contains(emailToRemove)) {
     cc.remove(emailToRemove);
     email.setCc(cc);
   } else if (bcc.contains(emailToRemove)) {
     bcc.remove(emailToRemove);
     email.setBcc(bcc);
   }
   return email;
 }