MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / mail

Method mail

src/org/opensourcephysics/desktop/OSPDesktop.java:134–152  ·  view source on GitHub ↗

Launches the default email program with the given address. @param addr @return true if successful

(String addr)

Source from the content-addressed store, hash-verified

132 * @return true if successful
133 */
134 static public boolean mail(String addr) {
135 if(!desktopSupported||(addr==null)) {
136 return false;
137 }
138 java.lang.reflect.Method m;
139 Class<?>[] parameters = new Class[] {java.net.URI.class};
140 try {
141 java.net.URI uri = new java.net.URI("mailto:"+addr.trim()); //$NON-NLS-1$
142 m = Class.forName(desktopClassName).getMethod("getDesktop", (Class<?>[]) null); //$NON-NLS-1$
143 Object desktop = m.invoke(null, (Object[]) null);
144 m = Class.forName(desktopClassName).getMethod("mail", parameters); //$NON-NLS-1$
145 Object[] args = {uri};
146 m.invoke(desktop, args);
147 return true;
148 } catch(Exception e) {
149 e.printStackTrace();
150 return false;
151 }
152 }
153
154 /**
155 * Launches the default email program without a recipient.

Callers

nothing calls this directly

Calls 3

invokeMethod · 0.80
trimMethod · 0.45
forNameMethod · 0.45

Tested by

no test coverage detected