Skip to content

Instantly share code, notes, and snippets.

@oxtoacart
Created December 6, 2013 16:34
Show Gist options
  • Save oxtoacart/7827829 to your computer and use it in GitHub Desktop.
Save oxtoacart/7827829 to your computer and use it in GitHub Desktop.
import java.awt.Desktop;
import java.net.URI;
import java.net.URLEncoder;
public class TestMailto {
public static void main(String[] args) throws Exception {
String recipient = "ox@getlantern.org";
String subject = URLEncoder
.encode("Join the Lantern Network to Circumvent Censorship");
String body = URLEncoder
.encode("You can download lantern from http://getlantern.org (should replace this with custom installer URL).");
Desktop.getDesktop().mail(
new URI(String.format("mailto:%1$s?subject=%2$s&body=%3$s",
recipient, subject,
body)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment