Reputation: 61
i've followed this example CodenameOne message Class but i get getting this exception
> java.io.IOException: Failed to open mailto:[email protected]?body=Body%20of%20message&subject=Subject%20of%20message. Error message: Un périphérique attaché au système ne fonctionne pas correctement.
> at sun.awt.windows.WDesktopPeer.ShellExecute(WDesktopPeer.java:90)
at sun.awt.windows.WDesktopPeer.mail(WDesktopPeer.java:71)
at java.awt.Desktop.mail(Desktop.java:474)
at com.codename1.impl.javase.JavaSEPort.sendMessage(JavaSEPort.java:6667)
at com.codename1.ui.Display.sendMessage(Display.java:3251)
please help i didn't find much documentation to go with, here's my code
Message m = new Message("Body of message");
m.getAttachments().put("/resources/test.txt", "text/plain");
Display.getInstance().sendMessage(new String[] {"[email protected]"}, "Subject of message", m);
Upvotes: 1
Views: 262
Reputation: 52760
The exception is because JavaSE failed to find a default mail application defined in your system. This will act correctly on the device where the OS native mail app will launch when you invoke that call.
Upvotes: 1