1 21 22 27 28 package javax.mail.internet; 29 30 import java.net.*; 31 import javax.mail.Session ; 32 33 44 45 class UniqueValue { 46 51 private static int part = 0; 52 53 56 private static int id = 0; 57 58 65 public static String getUniqueBoundaryValue() { 66 StringBuffer s = new StringBuffer (); 67 68 s.append("----=_Part_").append(part++).append("_"). 70 append(s.hashCode()).append('.'). 71 append(System.currentTimeMillis()); 72 return s.toString(); 73 } 74 75 90 public static String getUniqueMessageIDValue(Session ssn) { 91 String suffix = null; 92 93 InternetAddress addr = InternetAddress.getLocalAddress(ssn); 94 if (addr != null) 95 suffix = addr.getAddress(); 96 else { 97 suffix = "javamailuser@localhost"; } 99 100 StringBuffer s = new StringBuffer (); 101 102 s.append(s.hashCode()).append('.').append(id++). 104 append(System.currentTimeMillis()).append('.'). 105 append("JavaMail."). 106 append(suffix); 107 return s.toString(); 108 } 109 } 110 | Popular Tags |