Revision 2330
Added by Duane Costa over 19 years ago
HarvestSiteSchedule.java | ||
---|---|---|
529 | 529 |
void reportToSiteContact() { |
530 | 530 |
PrintStream body; |
531 | 531 |
String from = harvester.harvesterAdministrator; |
532 |
String[] fromArray; |
|
532 | 533 |
String maxCodeLevel = "info"; |
533 | 534 |
MailMessage msg; |
534 | 535 |
int nErrors = 0; |
535 | 536 |
String subject = "Report from Metacat Harvester: " + harvester.timestamp; |
536 | 537 |
String to = contactEmail; |
538 |
String[] toArray; |
|
537 | 539 |
|
538 | 540 |
if (!to.equals("")) { |
539 | 541 |
System.out.println("Sending report to siteScheduleID=" + siteScheduleID + |
540 | 542 |
" at address: " + contactEmail); |
541 | 543 |
try { |
542 | 544 |
msg = new MailMessage(harvester.smtpServer); |
543 |
msg.from(from); |
|
544 |
msg.to(to); |
|
545 |
msg.cc(from); |
|
545 |
|
|
546 |
if (from.indexOf(',') > 0) { |
|
547 |
fromArray = from.split(","); |
|
548 |
|
|
549 |
for (int i = 0; i < fromArray.length; i++) { |
|
550 |
if (i == 0) { |
|
551 |
msg.from(fromArray[i]); |
|
552 |
} |
|
553 |
|
|
554 |
msg.cc(fromArray[i]); |
|
555 |
|
|
556 |
} |
|
557 |
} |
|
558 |
else if (from.indexOf(';') > 0) { |
|
559 |
fromArray = from.split(";"); |
|
560 |
|
|
561 |
for (int i = 0; i < fromArray.length; i++) { |
|
562 |
if (i == 0) { |
|
563 |
msg.from(fromArray[i]); |
|
564 |
} |
|
565 |
|
|
566 |
msg.cc(fromArray[i]); |
|
567 |
|
|
568 |
} |
|
569 |
} |
|
570 |
else { |
|
571 |
msg.from(from); |
|
572 |
msg.cc(from); |
|
573 |
} |
|
574 |
|
|
575 |
if (to.indexOf(',') > 0) { |
|
576 |
toArray = to.split(","); |
|
577 |
|
|
578 |
for (int i = 0; i < toArray.length; i++) { |
|
579 |
msg.to(toArray[i]); |
|
580 |
} |
|
581 |
} |
|
582 |
else if (to.indexOf(';') > 0) { |
|
583 |
toArray = to.split(";"); |
|
584 |
|
|
585 |
for (int i = 0; i < toArray.length; i++) { |
|
586 |
msg.to(toArray[i]); |
|
587 |
} |
|
588 |
} |
|
589 |
else { |
|
590 |
msg.to(to); |
|
591 |
} |
|
592 |
|
|
546 | 593 |
msg.setSubject(subject); |
547 | 594 |
body = msg.getPrintStream(); |
548 | 595 |
harvester.printHarvestHeader(body, siteScheduleID); |
Also available in: Unified diff
Minor enhancement to support multiple email addresses for harvester administrator and site contact. Each address is separated by a comma or semicolon.